XMLNodeFromPath()
Syntax
*Result = XMLNodeFromPath(*ParentNode, Path$)Description
Returns the XML node inside *ParentNode who's relation to *ParentNode is described through 'Path$'. XMLNodePath() can be used to get such a path to a node.
Parameters
Path$ contains a list of node names separated by '/' to indicate the way to follow from the parent to the target node. For example "childtag/subchildtag" specifies the first node with name "subchildtag" inside the first node with name "childtag" inside *ParentNode.
A node name can have an index (one based) to specify which of multiple child tags of the same name should be selected. "childtag/subchildtag[3]" specifies the 3rd "subchildtag" inside the first "childtag" of *ParentNode.
Other rules:
- If a path starts with '/' it is relative to the tree's root. No matter which node *ParentNode specifies.
- A Wildcard "*" can be used instead of a tag name to specify that any tag is to be selected.
- A Comment node has the tagname "#comment"
- A CData node has the tagname "#cdata"
- A DTD node has the tagname "#dtd"
- A Processing Instruction node has the tagname "#instruction"
Some examples of valid paths:"/mainnode/#comment[4]" - the 4th comment inside the "mainnode" node inside the root of the tree "*[10]" - the 10th node (of any type) inside *ParentNode "*/*/*" - the 1st node 3 levels below *ParentNode independent of its type "node[3]/*[3]/#cdata" - the first CData section inside the 3rd node of any kind inside the 3rd "node" node inside *ParentNodeNote: This command is no implementation of the XPath specification. The syntax used and understood by this command is only a small subset of XPath. This means a path returned from XMLNodePath() is a valid XPath query, but this command only understands the syntax described here, not just any XPath query.
Return value
Returns the node pointer of the target node or 0 if the path did not lead to a valid node.
Supported OS
All