I'm trying to use PHPxml for working with
XML document. Everyting works fine except adding the new nodes. Frankly
speaking, method add_node doesn't work.
It returns path for the new node, but when I'm
trying to get the results and show them or save it to file - I see NO new node
that had been added.
Please take a look at my code:
// Include the <phpXML/>
// Create an XML object for the XML file.
= new XML("some.xml");
$nn = $xml->add_node("/", "node");
// characters translation
$xs = strtr($xml->get_file(), $trans);
get_file methid returns original
XML - simply <root/>. Note that I tried different variations of path
parameter string in add_node method. (ie "root/", "/root",
".", "/", "/root/"... and so on)
When I 'm trying to get the path for the new
created node I get a result - root/node. But
there no new node in the xml.
Please, can you explain me why this happens? Or maybe
I'm using add_node not very correctly?