Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, make sure that your XML file is indeed UTF-8 encoded. If not specify the encoding as the second parameter to <a href="http://php.net/manual/en/xmlreader.open.php" rel="nofollow noreferrer"><code>XMLReader::open()</code></a>.</p> <p>If the encoding error is due a real malformed byte sequence in an UTF-8 document and if you're using PHP > 5.2.0 you could pass <code>LIBXML_NOERROR</code> and/or (depending on the error level) <code>LIBXML_NOWARNING</code> as a bitmask to the third parameter of <a href="http://php.net/manual/en/xmlreader.open.php" rel="nofollow noreferrer"><code>XMLReader::open()</code></a>:</p> <pre><code>$xml = new XMLReader(); $xml-&gt;open('myxml.xml', null, LIBXML_NOERROR | LIBXML_NOWARNING); </code></pre> <p>If your're using PHP > 5.1.0 you can tweak the <a href="http://php.net/manual/en/book.libxml.php" rel="nofollow noreferrer"><code>libXML</code></a> error-handling.</p> <pre><code>// enable user error handling libxml_use_internal_errors(true); /* ... do your XML processing ... */ $errors = libxml_get_errors(); foreach ($errors as $error) { // handle errors here } libxml_clear_errors(); </code></pre> <p>I actually don't know if the preceding two work-arounds actually allow <code>XMLReader</code> to continue reading in case of an error or if they only suppress the error output. But it's worth a try.</p> <hr> <p><strong>Responding to comment:</strong></p> <p><code>libXML</code> defines <a href="http://www.xmlsoft.org/html/libxml-parser.html#xmlParserOption" rel="nofollow noreferrer"><code>XML_PARSE_RECOVER</code></a> (1) but ext/libxml does not expose this constant as a PHP constant. Perhaps it's possible to pass the integer value <code>1</code> to the <code>$options</code> parameter.</p> <pre><code>$xml = new XMLReader(); $xml-&gt;open('myxml.xml', null, LIBXML_NOERROR | LIBXML_NOWARNING | 1); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload