Simple question, quick answer ?
Posted: Sat Apr 26, 2008 8:06 am
Hi all
I would like to check this :
I have a valid DOMXPath handler $xpath based on a valid XML DOMDocument, and a string $urlpart.
The XML document has basically this structure :
I want $treeid to contain the ID of the <tree> element for which one of the <url> descendants (either the direct child <url> or one <url> of a <branch> element) has the value of $urlpart.
Is the following correct
Thanks for your help !
I would like to check this :
I have a valid DOMXPath handler $xpath based on a valid XML DOMDocument, and a string $urlpart.
The XML document has basically this structure :
Code: Select all
<forest>
<tree id="treeID">
<url>tree URL</url>
<branch>
<url>branch URL 1</url>
</branch>
<branch>
<url>branch URL 2</url>
</branch>
...
</tree>
<tree>
...
</tree>
...
</forest>Is the following correct
Code: Select all
$treeid = $xpath->query("//tree[.//url[.='{$urlpart}']][1]/@id");
Thanks for your help !