LibXML: Validating Schema using LibXML
by Johannes Kilian other posts by this author
Jul 26 2005 7:37AM messages near this date
view in the new Beta List Site
cgi app broken after upgrading XML::DOM and XML::Parser modules
|
Re: LibXML: Validating Schema using LibXML
& XSLT Hi there,
I want to validate a XML-File against a Schema.
As the xml::libxml:*:schema documentation suggests, the
validate-function should always be "evaluated":
'*This function allows to validate a document against the given XML
Schema. If this function succeeds, it will return 0, otherwise it will
|die()| and report the errors found. Because of this |validate()|
<http://pcjok2.vitronic.de/ASPNPerl/site/lib/XML/LibXML/Schema.html#item_validate>
should be always evaluated.'
Considering this, I tried following:
---------------------------
use XML::LibXML;
my $xmlschema = XML::LibXML::Schema-> new( location => 'schema.xsd' );
my $parser=XML::LibXML-> new;
my $doc=$parser-> parse_file( 'invalid.xml' );
eval {
$xmlschema-> validate( $doc );
};
print "File failed validation: $@" if $@;
------------------------------------
But validate() just dies inside, without being catched by the
eval{}-construct.
Whats wrong here?
Thanks
Johannes
**
Attachments:
jok.vcf
unknown1
unknown2
Thread:
Johannes Kilian
Petr Pajas
Johannes Kilian
Petr Pajas
Johannes Kilian
|