ID: 34707
Updated by: [EMAIL PROTECTED]
Reported By: apc at hotmail dot kg
-Status: Open
+Status: Wont fix
Bug Type: XML related
Operating System: Windows XP Pro SP2
PHP Version: 4.4.0
New Comment:
Simply, you can't use the same parser twice... Just make a new
one for the second parsing.
Previous Comments:
------------------------------------------------------------------------
[2005-10-02 16:58:43] apc at hotmail dot kg
Description:
------------
When I try to parse XML into struct twice using the same parser -
second attempt fails.
Reproduce code:
---------------
<?php
$t=('../test/eg_snews.xml'); // any XML file
$XMLContent = file_get_contents($t);
$th = xml_parser_create();
echo "<hr>";
var_dump(xml_parse_into_struct ($th, $XMLContent, $V)); ;
echo "<br>Result size: ".sizeof($V);
echo "<br>Error code: ".$ec=xml_get_error_code($th);
echo "<br>Error text: ".xml_error_string($ec);
echo "<hr>";
var_dump(xml_parse_into_struct ($th, $XMLContent, $V)); ;
echo "<br>Result size: ".sizeof($V);
echo "<br>Error code: ".$ec=xml_get_error_code($th);
echo "<br>Error text: ".xml_error_string($ec);
?>
Expected result:
----------------
int(1)
Result size: 301
Error code: 0
Error text:
int(1)
Result size: 301
Error code: 0
Error text:
Actual result:
--------------
int(1)
Result size: 301
Error code: 0
Error text:
int(0)
Result size: 0
Error code: 9
Error text: junk after document element
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34707&edit=1