#!/bin/perl -w use strict; use XML::Checker::Parser; $/=''; # records are now separated by an empty line # first parse, a valid document my $doc1=; my $p= new XML::Checker::Parser; eval { local $XML::Checker::FAIL= \&my_fail; $p->parse( $doc1); }; if( $@) { print "parse 1 failed: $@\n"; } else { print "parse 1 OK\n"; } # second parse, an invalid document my $doc2=; $p= new XML::Checker::Parser; eval { local $XML::Checker::FAIL= \&my_fail; $p->parse( $doc2); }; if( $@) { print "parse 2 failed: $@\n"; } else { print "parse 2 OK\n"; } # gets an error and dies after creating the error message sub my_fail { my ($code, $msg, %context)= @_; die " error $code ($msg) at line $context{line}, column $context{column}"; } __DATA__ ]> foobar ]> toto not empty foobar #### 228a229,232 > > # added by mirod > $checker->fail (149, "invalid text content [$str]") > unless $str=~ /^\s*$/; 1662c1666 < =head2 150 - 159 --- > =head2 149 - 159 1664a1669,1675 > > =item * > > B<149> - invalid text content [$value] > > A text was found in an element that should only include sub-elements > The text is not made of non-significant whitespace.