in reply to How to use xml schema in perl
Validation of XML Schemas is covered in the Perl XML FAQ
You may need to update the libxml2 library on your system if it is quite old (and then rebuild XML::LibXML::Common and XML::LibXML)use XML::LibXML; my $schema_file = 'po.xsd'; my $document = 'po.xml'; my $schema = XML::LibXML::Schema->new(location => $schema_file); my $parser = XML::LibXML->new; my $doc = $parser->parse_file($document); eval { $schema->validate($doc) }; die $@ if $@; print "$document validated successfully\n";
|
|---|