Where can I find the structure of the loader result?
Documentation provides only:
var result = loader.doXPath(“/some/expression[@arg=‘value’]”);
for(var i=0;i<result.length;i++){
alert(result[i].nodeName)
}
nodeName is in the example, but where do I find the other results?
F.e. The values of “/some/expression/*”
The result of doXPath method is a collection of XML nodes ( an array ) , so you can iterate through it same as in case of normal array.
Each element of array - XML node, which can be polled to get attributes or values of sub-child nodes.
So the structure of the array is like this? Nothing more or less?
| Property | Description | IE | F | O | W3C |
|---|---|---|---|---|---|
| baseURI | Returns the absolute base URI of a node | No | 1 | No | Yes |
| childNodes | Returns a NodeList of child nodes for a node | 5 | 1 | 9 | Yes |
| firstChild | Returns the first child of a node | 5 | 1 | 9 | Yes |
| lastChild | Returns the last child of a node | 5 | 1 | 9 | Yes |
| localName | Returns the local part of the name of a node | No | 1 | 9 | Yes |
| namespaceURI | Returns the namespace URI of a node | No | 1 | 9 | Yes |
| nextSibling | Returns the node immediately following a node | 5 | 1 | 9 | Yes |
| nodeName | Returns the name of a node, depending on its type | 5 | 1 | 9 | Yes |
| nodeType | Returns the type of a node | 5 | 1 | 9 | Yes |
| nodeValue | Sets or returns the value of a node, depending on its type | 5 | 1 | 9 | Yes |
| ownerDocument | Returns the root element (document object) for a node | 5 | 1 | 9 | Yes |
| parentNode | Returns the parent node of a node | 5 | 1 | 9 | Yes |
| prefix | Sets or returns the namespace prefix of a node | No | 1 | 9 | Yes |
| previousSibling | Returns the node immediately before a node | 5 | 1 | 9 | Yes |
| textContent | Sets or returns the textual content of a node and its descendants | No | 1 | No | Yes |
| text | Returns the text of a node and its descendants. IE-only property | 5 | No | No | No |
| xml | Returns the XML of a node and its descendants. IE-only property | 5 | No | No | No |
Also you can use getAttribute(attribute_name) method to get the attribute value.