XML::Parse dies hard

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Quoted text here. Click to load it

Repair the corrupted file:

   perl -p -i -e 'tr/\r//d' bad_file

    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas

Re: XML::Parse dies hard

On 14 Apr, 10:04, maxwe...@gmail.com wrote:
Quoted text here. Click to load it

Because your expectation of the behaviour of XML::Parser::parse does
not match the documented behaviour.

Consult the description of the parse method in the XML::Parser
documentation and adjust your expectation accordingly. Pay particular
note to the sentence "A die call is thrown if a parse error occurs.".

Re: XML::Parse dies hard

Thanks, Brian.

I got it to work thus:

use XML::Parser;
my $checker = new XML::Parser ( Handlers => { } );
my $stream = "<foo id=\"me\"Hello World</foo>";
eval { $checker->parse($stream); };
if ($@) { print "uh oh";
die; }

Site Timeline