From:             [EMAIL PROTECTED]
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>&#160;</AAA>";
$xmlString[1] = "<AAA>&nbsp;</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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to