title: Perl: How to parse invalid XML document?
body: <p>I have a XML document from outer source what I need parse every day over and over again with <code>XML::Simple</code> <code>perl</code> module. My script is running from crontab and it works fine if the XML document is healthy. But I get error messages and die if the document is not valid, something like this:</p>
  
  <pre><code>junk after document element at line 740774, column 0, byte 36355798 at /usr/local/lib/perl/5.18.2/XML/Parser.pm line 187.
  </code></pre>
  
  <p>I found this line in the XML document and it looks like this:</p>
  
  <pre><code>&lt;item&gt;
      &lt;element1&gt;value1&lt;/element1&gt;
      &lt;element2&gt;value2&lt;/element2&gt;
      value3&lt;/element3&gt;
      &lt;element4&gt;value4&lt;/element4&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>Can I parse this wrong document without die? Maybe drop this item from the parser with a warning (and not die!) or somehow ignore the errors?</p>