Bug in importFromString() ????
Brought to you by:
bs_php,
nigelswinson
From: J. C. <jan...@im...> - 2002-05-14 12:52:34
|
Hello, I would like to use the new Version but I got problems when changing something. Here is a simple example: ====================================================== <? require_once("XPath.class.php"); //new //require_once("XPath.class_V2.php"); //old $xmlfile="xmlfile.xml"; echo "[new XPath]<BR>"; $xpath = new XPATH($xmlfile); echo "[appenChild \"TEST\" to \"root[1]\"]<BR>"; $child=$xpath->appendChild("/root[1]","TEST"); echo "[replaceData \"TEST\"]<BR>"; $xpath->replaceData($child,"TEST"); echo "[exportToFile] <BR>"; $xpath->exportToFile($xmlfile,'','<?xml version="1.0" encoding="iso-8859-1" standalone="yes"'.'?'.'>'); ?> ====================================================== This code gives me this output: ====================================================== [new XPath] [appenChild "TEST" to "root[1]"] XPath error in XPath.class.php:4524 XPath error in XPath.class.php:1454. Message: In importFromString(): XML error in given string on line 1 column 0. Reason:syntax error [replaceData "TEST"] [exportToFile] PHP Warning: Undefined variable: PHP_SELF in C:\Server-Entwicklung-V2\imeso\web\Administration\data\XPath.class.php on line 4698 ====================================================== The XML Code is: ====================================================== <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?><root> </root> ====================================================== When I use the old version it works nice so I think it might be a bug. Any help? (The warning is no problem - I normally comment that section at line 4698) Cheers Jan |