dimanche 26 avril 2015

How to delete child node from xml using php


$xpath = new DOMXPATH($xml);

foreach($xpath->query("/root/info[name = '$c_name']") as $node)
{
    $node->parentNode->removeChild($node);
}

Am getting this error when executing this code on localhost. "Warning: DOMXPath::query(): Invalid expression " I guess there is an error in the foreach loop. How can i remedy for this!


Aucun commentaire:

Enregistrer un commentaire