Created
October 27, 2009 16:21
-
-
Save dedeibel/219693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use XML::LibXML; | |
if (@ARGV != 2) { | |
print "$0 <xml file> <schema file>\n"; | |
exit 1; | |
} | |
my $url = $ARGV[0]; | |
my $xsd = $ARGV[1]; | |
print "Validating: $url with $xsd\n"; | |
my $doc = XML::LibXML->new->parse_file($url); | |
my $xmlschema = XML::LibXML::Schema->new(location => $xsd); | |
eval { $xmlschema->validate($doc); print "Dokument okay.\n"; }; | |
if ($@) { | |
print "Dokument has errors: $@\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment