Commit a99678db authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-11-26 16:15:24 by szach] schema test script

Original author: szach
Date: 2003-11-26 16:15:24+00:00
parent ef473abc
#!/usr/bin/perl -w
use strict;
sub get_root($) {
my ($f) = @_;
open (F, "< $f");
while (my $l = <F>) {
if ($l =~ /.*element\s+name\s*=\s*"(\w+)".*/) {
close F;
return($1);
}
}
die "Can't find root element in schema $f\n";
}
foreach my $s (@ARGV) {
if ($s =~ /(.*)\.xsd$/) {
print "Testing $s ...\n";
open(CD, "> test.cd");
my $root = get_root($s);
print CD <<EOF;
schema X = \"$s\";;
#print_type X # $root;;
EOF
if (-f "$1.xml") {
print CD <<EOF;
let x = load_xml "$1.xml";;
validate x with X # $root;;
EOF
}
close CD;
system "`which cduce` < test.cd";
} else {
print "Ignoring $s ...\n"
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment