First of all, make sure that your XML file is indeed encoded in UTF-8 encoding. If you do not specify the encoding as the second parameter XMLReader::open().
UTF-8, PHP > 5.2.0, LIBXML_NOERROR / ( ) LIBXML_NOWARNING XMLReader::open():
$xml = new XMLReader();
$xml->open('myxml.xml', null, LIBXML_NOERROR | LIBXML_NOWARNING);
PHP > 5.1.0, libXML .
libxml_use_internal_errors(true);
$errors = libxml_get_errors();
foreach ($errors as $error) {
}
libxml_clear_errors();
, XMLReader . .
:
libXML XML_PARSE_RECOVER (1), ext/libxml PHP. , 1 $options.
$xml = new XMLReader();
$xml->open('myxml.xml', null, LIBXML_NOERROR | LIBXML_NOWARNING | 1);