XML::Filter::ExceptionLocatorFilter to add line/col numbers to SAX errors | |
Download |
XML::Filter::ExceptionLocator Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Publisher Name:
- Sam Tregar
- Publisher web site:
- http://search.cpan.org/~wonko/
XML::Filter::ExceptionLocator Tags
XML::Filter::ExceptionLocator Description
Filter to add line/col numbers to SAX errors XML::Filter::ExceptionLocator is a Perl module that implements a SAX filter which adds line-numbers and column-numbers to errors generated by SAX handlers futher down the pipeline.SYNOPSIS use XML::Filter::ExceptionLocator; use XML::SAX::ParserFactory; # parse some.xml adding line/col numbers to any errors that get # thrown from $whatever my $filter = XML::Filter::ExceptionLocator->new(Handler => $whatever); my $parser = XML::SAX::ParserFactory->parser(Handler => $filter); eval { $parser->parse_uri('some.xml'); } # the error object will have LineNumber and ColumnNumber now if ($@ and ref $@ and $@->isa('XML::SAX::Exception')) { print "Your error is at line $@->{LineNumber}, col $@->{ColumnNumber}\n"; } # if you print the error the line and column are included print $@; Requirements: · Perl
XML::Filter::ExceptionLocator Related Software