logo       

Re: More Verbose ::Parser Errors Through ::Simple?: msg#00066

lang.perl.xml

Subject: Re: More Verbose ::Parser Errors Through ::Simple?

On Fri, 19 Dec 2003, Morbus Iff wrote:

> Hey all. Is there a way I can get more verbose errors from XML::Parser,
> through XML::Simple? I'm getting stuff like "invalid entity on line 12
> column 123" or "mismatched tag", but I'm really hoping for something
> similar to Mozilla's parser: it'll give the error, as well as the
> two lines or so surrounding the cause of the error.

>From the doc:

parseropts => [ XML::Parser Options ] (in) (don't use this)
Note: This option is now officially deprecated. If you find it
useful, email the author with an example of what you use it for.

Use this option to specify parameters that should be passed to the
constructor of the underlying XML::Parser object (which of course
assumes you're not using SAX).

try the ErrorContext option

#!/usr/bin/perl -w
use strict;
use XML::Simple;
$XML::Simple::PREFERRED_PARSER= 'XML::Parser';

my $s= XMLin( \*DATA, parseropts => [ ErrorContext => 1]);

__DATA__
<doc>
<foo>text</foo1>
</doc>

--
Michel Rodriguez
Perl &amp; XML
http://www.xmltwig.com

_______________________________________________
Perl-XML mailing list
Perl-XML@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise