#! /usr/bin/perl use XML::LibXML; sub report_validate { my $document = $_[0]; my $schema_file = "$CONF_DIR/" . "schema.xsd"; my $schema = XML::LibXML::Schema->new(location => $schema_file); my $parser = XML::LibXML->new; eval { # Parser le document my $doc = $parser->parse_file($document); # Valider le $schema->validate($doc) }; if ($@) { print "Validation du document a echoué:\n"; print $@; return 0; } return 1; }
|