diff options
author | Rob Austein <sra@hactrn.net> | 2007-06-20 14:58:47 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-06-20 14:58:47 +0000 |
commit | 4c9b943f34f6bbe7ec1005265e121c4b93ab1299 (patch) | |
tree | 27ebd973aa2f150214ac7ff85296c27560662d92 /scripts/xml-parse-test.pl | |
parent | 16d514176b50cbc509d63f257388fbbc9585e371 (diff) |
XML validation sort of working
svn path=/scripts/xml-parse-test.pl; revision=674
Diffstat (limited to 'scripts/xml-parse-test.pl')
-rwxr-xr-x | scripts/xml-parse-test.pl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/xml-parse-test.pl b/scripts/xml-parse-test.pl index 0a7256b0..fa4b24ad 100755 --- a/scripts/xml-parse-test.pl +++ b/scripts/xml-parse-test.pl @@ -9,11 +9,11 @@ use strict; use XML::Simple; use Data::Dumper; use IPC::Open2; -use Getopt::Long; my %opt; if (0) { + use Getopt::Long; my $usage = "Use The Source, Luke"; die($usage) unless GetOptions(\%opt, qw(encode! decode! schema=s key=s cert=s dir=s)) @@ -68,8 +68,9 @@ sub decode { sub relaxng { my $xml = shift; my $schema = shift; - my @res = run2($xml, qw(xmllint --relaxng), $schema, q(-)); - return join('', @res); + open(F, "| xmllint --relaxng $schema - 2>&1") or die; + print(F $xml) or die; + return close(F); } my $xs = XML::Simple->new(KeepRoot => 1, @@ -162,7 +163,9 @@ for my $xml (@xml) { $xml = decode($cms, $opt{dir}); print("4: ", $xml, "\n"); print("5: ", Dumper($xs->XMLin($xml)), "\n"); - print("6: ", relaxng($xml, $opt{schema}), "\n"); + print("6: "); + relaxng($xml, $opt{schema}); + print("\n"); # my $x = $xs->XMLin($xml); # my $t = $xs->XMLout($x); |