Which is better for working with XML in PHP?

The task is this: you need to add and remove in XML using PHP. What is the easiest way to implement this?


Answer 1, authority 100%

if only add and remove – simplexml…
You can read about it here


Answer 2, authority 100%

I use DOMDocument.
Everything is quite simple there:

$domxml = new DOMDocument();
$domxml->loadXML("<root><elem /></root>"); //  XML   
$domxml->load("localfile.xml"); //   xml-
$domxml->load("http://domen.com/file.xml"); //   xml-
$root = $domxml->createElement("root"); //   
$root->appendChild("elem"); //    
$domxml->saveXML(); //  XML  

I have an XML class that extends the basic functionality a bit. I can share.