I want to delete all the empty nodes in my XML document using SimpleXML
Here is my code :
$xs = file_get_contents('liens.xml')or die("Fichier XML non chargé");
$doc_xml = new SimpleXMLElement($xs);
foreach($doc_xml->xpath('//*[not(text())]') as $torm)
unset($torm);
$doc_xml->asXML("liens.xml");
I saw with a print_r()
that XPath is grabbing something, but nothing is removed from my XML file.