Bug #15092: xml_parse() fails if XML-data contains entity like or © ...
| From: | bs_php at infeer dot com | Date: | Fri, 18 Jan 2002 02:03:08 +0000 |
| Subject: | Bug #15092: xml_parse() fails if XML-data contains entity like or © ... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-77384@lists.php.net to get a copy of this message | ||
From: bs_php@infeer.com
Operating system: Win 2k (all I gues)
PHP version: 4.1.0
PHP Bug Type: XML related
Bug description: xml_parse() fails if XML-data contains entity like or © ...
PHP XML-parser has problems with the full iso8859-1 char set when trying to
use entity names. E.g. the parser will fail with "undefined entity" if the
XML data you parse contains or © a.s.o. (there many more).
Some entities do work, like < > & as well as the alternative
notation unsing the ISO-code number: like non-breaking space ===  
For a full iso8859-1 list and it's entities see:
http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html
Here's the test script you can use to check the error :
<?php
$xmlString[0] = "<AAA> </AAA>";
$xmlString[1] = "<AAA> </AAA>";
function startElement($xml_parser, $name, $attrs) {}
function endElement($xml_parser, $name) {}
function characterData($xml_parser, $text) {echo "Handling character
data: '".htmlspecialchars($text)."'<br>";}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
// Parse the XML data.
if (!xml_parse($xml_parser, $xmlString[1], TRUE)) {
echo "XML error in given {$source} on line ".
xml_get_current_line_number($xml_parser) .
' column ' . xml_get_current_column_number($xml_parser) .
'. Reason:' . xml_error_string(xml_get_error_code($xml_parser));
}
?>
--
Edit bug report at: http://bugs.php.net/?id=15092&edit=1