squareroot3 has asked for the wisdom of the Perl Monks concerning the following question:
the xml file is here :use XML::Checker::Parser; my %expat_options = (KeepCDATA => 1, Handlers => [ Unparsed => \&my_Unparsed_handler +]); my $parser = new XML::Checker::Parser (%expat_options); eval { local $XML::Checker::FAIL = \&my_fail; $parser->parsefile ("fail.xml"); }; if ($@) { print $@; } else{ print "xml has been validated"; } sub my_fail { my $code = shift; die XML::Checker::error_string ($code, @_) if $code < 200; XML::Checker::print_error ($code, @_); }
In this case, there should be an error msg to be printed,<!DOCTYPE a [ <!ELEMENT a (b,c!)> <!ELEMENT b (#PCDATA)> <!ELEMENT c (#PCDATA)> ]> <a> "something should not be here" <b></b> <c></c> </a>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem using XML::Checker::Parser
by GrandFather (Saint) on Aug 08, 2007 at 01:42 UTC | |
by squareroot3 (Initiate) on Aug 08, 2007 at 16:07 UTC | |
|