|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-20 11:25 UTC] jacek dot prucia at 7bulls dot com
consider XML file beginning with: <?xml version='1.0'?> everything is just fine, but let us have a small typo - lack of question sign at the end like this: <?xml version='1.0'> this isn't correct, but xml_parse() isn't returning FALSE (as it is supposed to do in case of an error). Instead xml_parse() goes on but it isn't able to find any XML element which gives impression of xml_parse() being totally dead... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
hi you have to call xml_parse with the third argument is_final set to true, when you parse the last part of your xml-document. Then it shows the error. The following script works fine for me: <?php $xml = "<?xml version='dd'?><root/>"; $xml_parser = xml_parser_create(); if (!xml_parse($xml_parser, $xml,1)) { printf("XML error: %s at line %d\n%d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser)); die(); } ?> chregu