selectSingleNode, selectNodes,
getChildNodes, etc.), the node context will always be the root node (documentElement) and
not the parser instance (ownerDocument). Therefore, all queries are assumed to begin at the root, meaning
querying an instance of this class for the root node (assuming its name is "Price") would require a query such
as "." or "/Price", not "Price".
Note that several methods of this class fail quietly when an error occurs with the wrapped native browser XML
classes. Methods that are documented as failing quietly should always be followed by a call to
hasError() to ensure that no error has occurred.| Field Summary | |
|---|---|
| static String | Event type published when an error occurs during the asynchronous loading of a document. |
| static String | Event type published when an asynchronous load operation has completed successfully. |
| static String | Event type published when an asynchronous load times out before loading. |
| static String | Namespace to use when querying against the namespace axis in firefox |
| static String | Prefix to use when querying against the namespace axis in firefox |
| Constructor Summary | |
|---|---|
| void | The instance initializer. |
| Method Summary | |
|---|---|
| jsx3.xml.Document | Creates a new node that is an exact clone of this node; returns the newly cloned node wrapped in a jsx3.xml.Entity instance |
| jsx3.xml.Entity | Creates a new root node on an empty document. |
| String | The Firefox implementation of the XSLT specification does not implement a searchable namespace axis. |
| void | Creates a processing instruction node that containing the target and data information. |
| boolean | getAsync(strName : ?) Returns whether this document loads asynchronously. |
| Object | getDeclaredNamespaces(objMap : Object) Returns a map of all implemented namespaces in the following format: {some_uri:"jsx1",some_other_uri,"jsx2",another_uri:"jsx3"}. |
| Object | Returns the native XML parser |
| boolean | Returns whether or not the parser should resolve externally referenced entities. |
| String | Gets the selection language to use for selection queries (i.e. |
| String | getSelectionNamespaces(strName : ?) Gets a list of namespace prefixes and their associated URIs. |
| String | |
| boolean | Returns whether or not the parser should validate the XML content during the initial parse. |
| static String | Deprecated. |
| String | |
| boolean | |
| String | |
| jsx3.xml.Document | Loads an XML document at the URL specified by the strURL parameter. |
| jsx3.xml.Document | Loads an XML document from a string containing the XML source. |
| void | |
| jsx3.xml.Document | Sets whether this document loads asynchronously. |
| void | setResolveExternals(bResolve : boolean) Sets whether or not the parser should resolve externally referenced entities. |
| jsx3.xml.Document | setSelectionLanguage(strLanguage : String) Sets the selection language to use for selection queries (i.e. |
| jsx3.xml.Document | setSelectionNamespaces(declaration : Object | String) Sets a list of namespace prefixes and their associated URIs. |
| void | setValidateOnParse(bValidate : boolean) Sets whether or not the parser should validate the XML content during the initial parse. |
| Methods Inherited From jsx3.util.EventDispatcher |
|---|
| publish, subscribe, unsubscribe, unsubscribeAll |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf |
| Field Detail |
|---|
| Constructor Detail |
|---|
| Method Detail |
|---|
Usage:
var objDoc = new jsx3.xml.Document();
objDoc.createDocumentElement("myRoot");
getDeclaredNamespaces
is useful to resolve the prefix actually used, providing a reverse-lookup to resolve the actual prefix being used.
For example, assume objMap is the return object when calling getDeclaredNamespaces. In such a case, the following
query can be used to locate the URI for a given namespace prefix, even though Firefox does not support such a construct:
var objMap = someDoc.getDeclaredNamespaces(); var myXpathQuery = "ancestor-or-self::*[attribute::" + objMap[jsx3.xml.Document.SEARCHABLE_NAMESPACE] + ":xsd]/attribute::" + objMap[jsx3.xml.Document.SEARCHABLE_NAMESPACE] + ":xsd"; var objNode = someNode.selectSingleNode(myXpathQuery,objMap);
xmlns:jsx_xmlns="?"), the prefix will be
incremented as follows: jsx_xmlns0, jsx_xmlns1, jsx_xmlns2, etc, until a unique prefix is found. Usage:
[document].createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\"");
[document].createDocumentElement("myRoot");
//open an XML Document (just use one of the sample prototypes that ships with Builder)
var objXML = new jsx3.xml.Document();
objXML.load("GI_Builder/prototypes/Block/Text.xml");
//get an object map of all known selection namespaces
var objMap = objXML.getDeclaredNamespaces();
//construct a qualified query (Note that all nodes in a GI serialization file belong to the namespace, 'urn:tibco.com/v3.0')
var myQualifiedQuery = "//" + objMap["urn:tibco.com/v3.0"] + ":object";
//query the document for the given node.
var objNode = objXML.selectSingleNode(myQualifiedQuery,objMap);
//alert the return
alert(objNode);
{prefix1:1,prefix2:1}. If passed, the returned Object will resolve to any matched prefix, while using arbitrary sequential prefixes (jsx1, jsx2, etc) for all other uris.strURL parameter. If an error occurs while
loading the XML document, this method sets the error property of this document and returns quietly. If this
document loads synchronously, the results of the load will be available immediately after the call to this
method. Otherwise, this document publishes events through the EventDispatcher interface to notify
the client that loading has completed.null value will cause this operation
to wait forever.async
property of this document.strXML. If, for example, strXML is in unicode format, explicitly passing the UTF-8
encoding attribute will cause the load to fail, as the byte order will cause the parser to look for the
UTF-16 attribute.ON_RESPONSE, ON_ERROR, and
ON_TIMEOUT to notify the client that loading has finished.true the document loads asynchronously.XSLPattern, XPath{some_uri:"jsx1",some_other_uri,"jsx2"}
or in String format. For example: "xmlns:jsx1='some_uri' xmlns:jsx2='some_other_uri'"