http://www.ibm.com/developerworks/library/x-xpathphp/index.html
http://www.php.net/manual/en/class.domxpath.php
http://www.w3schools.com/xpath/
http://msdn.microsoft.com/en-us/library/ms256471.aspx
http://www.php.net/manual/en/class.domxpath.php
http://www.w3schools.com/xpath/
http://msdn.microsoft.com/en-us/library/ms256471.aspx
PHP DOM Xpath
php xpath
php dom xpath makes it very each to find and select elements / nodes in an xml documentselect nodes
assuming that $doc contains a PHP DOMDocument you can use xpath to remove all nodes at any level that have the name "Name" with the following code$xp = new DOMXPath($doc);
$nodes = $xp->query('//Name');
foreach($nodes as $n) {
$n->parentNode->removeChild($n);
}
$nodes = $xp->query('//Name');
foreach($nodes as $n) {
$n->parentNode->removeChild($n);
}
review
you may want to add this before and after the transformation so you can see what has happened !select nodes by attribute
or select all nodes that have the attribute 'editable' with the value 'false'$nodes = $xp->query("//*[@editable='false']");
REFERRERS
PhpXml