note 43212 deleted from function.dom-domxpath-query by didou
| From: | didou@php.net | Date: | Sun, 19 Dec 2004 11:59:54 +0000 |
| Subject: | note 43212 deleted from function.dom-domxpath-query by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82040@lists.php.net to get a copy of this message | ||
Note Submitter: benoit dot toutain at free dot fr
----
Get a DOMXPath object :
<?php
$xmlString = '
<g id="points_topo">
<use id="points_topo_0" x="586004" y="-1466437" />
<use id="points_topo_1" x="586197" y="-1467479" />
<use id="points_topo_2" x="586664" y="-1468697" />
<use id="points_topo_3" x="584905" y="-1473660" />
<use id="points_topo_4" x="585005" y="-1469216" />
</g>';
$docSVG = new DOMDocument;
$docSVG->loadXML("$xmlString");
$objectXPath = new DOMXPath($docSVG);
$nodeList = $objectXPath->query("/g/use[@x > 586000]");
$i = 0;
while ( $node = $nodeList->item($i) )
{
echo "id = " . $node->getAttribute("id") . "<br/>\n";
$i++;
}
?>