I have a XML document from outer source what I need parse every day over and over again with XML::Simple
perl
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:
junk after document element at line 740774, column 0, byte 36355798 at /usr/local/lib/perl/5.18.2/XML/Parser.pm line 187.
I found this line in the XML document and it looks like this:
<item>
<element1>value1</element1>
<element2>value2</element2>
value3</element3>
<element4>value4</element4>
</item>
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?