You are here: Can't parse  -- Is this a bug in the SAX xml parser? Or am I doing something wrong? « PHP Programming Language « IT news, forums, messages
Can't parse  -- Is this a bug in the SAX xml parser? Or am I doing something wrong?

Posted by Joshua Beall on 11/11/07 02:05

Hi All,

Consider the following test code:

$xml = "<DATA>&#11;</DATA>";
$parser = xml_parser_create();
$result = xml_parse($parser,$xml);
$errorcode = xml_get_error_code($parser);
$errormsg = xml_error_string($errorcode);
$ln = xml_get_current_line_number($parser);
$cn = xml_get_current_column_number($parser);

var_dump($result);
echo "Error parsing XML document, '$errormsg' : Line $ln, Column $cn";




This will output:

int(0)
Error parsing XML document, 'Invalid character' : Line 1, Column 12



A return code of int(0) indicates failure. If you replace &#11; with
&#32;, it works with no error.

I don't understand why it's failing on &#11; -- isn't it perfectly
valid to include that numeric entity in the text content of an XML
node? Is this a bug? Or am I doing something wrong?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация