php Programming Glossary: thedocument
PHP - Delete XML Element http://stackoverflow.com/questions/1153697/php-delete-xml-element at php.net php doc new DOMDocument doc load 'theFile.xml' thedocument doc documentElement this gives you a list of the messages list.. documentElement this gives you a list of the messages list thedocument getElementsByTagName 'message' figure out which ones you want.. is just an example Now remove it. if nodeToRemove null thedocument removeChild nodeToRemove echo doc saveXML This should give you..
remove element from xml http://stackoverflow.com/questions/3317854/remove-element-from-xml file is php doc new DOMDocument doc load 'playlist.xml' thedocument doc documentElement list thedocument getElementsByTagName 'title'.. load 'playlist.xml' thedocument doc documentElement list thedocument getElementsByTagName 'title' nodeToRemove null foreach list.. 4' nodeToRemove domElement if nodeToRemove null thedocument removeChild nodeToRemove doc saveXML it gives following error..
|