[phpXML] add_node problem
Brought to you by:
bs_php,
nigelswinson
From: <se...@ww...> - 2001-10-08 17:48:35
|
Hello all, I'm trying to use PHPxml for working with XML document. Everyting works fin= e except adding the new nodes. Frankly speaking, method add_node doesn't wo= rk. It returns path for the new node, but when I'm trying to get the results an= d 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/> class. include("lib/xml.php"); // Create an XML object for the XML file. $xml =3D new XML("some.xml"); $nn =3D $xml->add_node("/", "node"); $fp =3D fopen("some2.xml","w+"); // characters translation $trans =3D get_html_translation_table(HTML_ENTITIES); $trans =3D array_flip($trans); $xs =3D strtr($xml->get_file(), $trans); // write fputs($fp, $xs); fclose($fp); ?> ---------------------------------------------------------------------------= ----- file SOME.XML: <?xml version=3D"1.0" encoding=3D"UTF-8"?> <root/> ---------------------------------------------------------------------------= ----- get_file methid returns original XML - simply <root/>. Note that I tried di= fferent 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[1]. But there no new node in the xml. Please, can you explain me why this happens? Or maybe I'm using add_node no= t very correctly? Serge. -- This message has been sent through the <phpXML/> user discussion list. To u= nsubscribe, please visit https://sslsites.de/mailinglisten/user/user@lists.= phpxml.org/ |