in reply to Re^2: Improving script that uses xmllint to validate
in thread Improving script that uses xmllint to validate

Hmm, try
#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; my $schemafile = 'base-schema.xsd'; my $schema = XML::LibXML::RelaxNG->new( location => $schemafile); my $filename = 'foo.xml'; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($filename); $schema->validate($doc); print "\n\nWe've made it this far without dying (ie you read this mess +age) $schemafile is valid, and so is $filename \n\n"

Replies are listed 'Best First'.
Re^4: Improving script that uses xmllint to validate
by matrixmadhan (Beadle) on Dec 27, 2008 at 16:46 UTC
    Thanks for the reply. Much appreciated.

    I will try it out.

    With this approach, schema file (xsd) need not be parsed, validated, loaded each and every time.