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

Thanks for the reply.

Currently am parsing only one xml file with xmllint

Passing multiple files to xmllint involves the overhead of creating multiple files, cleaning them after it is being used etc.
  • Comment on Re^2: Improving script that uses xmllint to validate

Replies are listed 'Best First'.
Re^3: Improving script that uses xmllint to validate
by Anonymous Monk on Dec 26, 2008 at 14:28 UTC
    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"
      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.