axis_examplecompt_changesinfo-ops
Last change
on this file since aaf7f41 was
549830d,
checked in by Ted Faber <faber@…>, 14 years ago
|
Set up a makefile to create a standalone version of topdl.xsd (called
topdl_stand.xsd) that can be used to validate topdl files.
validate.py uses lxml to validate such files locally, and fails gracefully without lxml.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[549830d] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use IO::File; |
---|
| 5 | |
---|
| 6 | my $usage = "Usage: $0 types schema [top_element_name]\n"; |
---|
| 7 | |
---|
| 8 | my $type_fn = shift || die $usage; |
---|
| 9 | my $topdl_fn = shift || die $usage; |
---|
| 10 | my $ename = shift || 'experiment'; |
---|
| 11 | |
---|
| 12 | my $id_type = "<!-- imported from $type_fn -->\n"; |
---|
| 13 | my $first; |
---|
| 14 | my $v; |
---|
| 15 | |
---|
| 16 | my $f = new IO::File($type_fn) || die "Can't open $type_fn: $!\n"; |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | while (<$f>) { |
---|
| 20 | (/<xsd:complexType name="IDType">/ .. m#</xsd:complexType>#) && do { |
---|
| 21 | $id_type .= $_; |
---|
| 22 | }; |
---|
| 23 | } |
---|
| 24 | $id_type .= "<!-- end import -->\n\n"; |
---|
| 25 | $f->close(); |
---|
| 26 | $f = new IO::File($topdl_fn) || die "Can't open $topdl_fn: $!\n"; |
---|
| 27 | |
---|
| 28 | while (<$f>) { |
---|
| 29 | ($v = /<xsd:schema/ .. />/) && do { |
---|
| 30 | chomp; |
---|
| 31 | if ($v == 1 ) { |
---|
| 32 | print "<!-- old schema declaration $_ "; |
---|
| 33 | } |
---|
| 34 | elsif ($v =~ /E0/) { |
---|
| 35 | print "$_ -->\n"; |
---|
| 36 | print "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/" . |
---|
| 37 | "XMLSchema\">\n"; |
---|
| 38 | } |
---|
| 39 | else { print "$_ "; } |
---|
| 40 | next; |
---|
| 41 | }; |
---|
| 42 | |
---|
| 43 | m#xmlns:fns="http://www.isi.edu/fedd_types"# && next; |
---|
| 44 | !$first && /<xsd:complexType/ && do { |
---|
| 45 | print $id_type; |
---|
| 46 | $first++; |
---|
| 47 | }; |
---|
| 48 | m#</xsd:schema># && do { |
---|
| 49 | print "<xsd:element name=\"$ename\" type=\"topologyType\"/>\n"; |
---|
| 50 | }; |
---|
| 51 | s/[tf]ns://g; |
---|
| 52 | print; |
---|
| 53 | } |
---|
| 54 | $f->close(); |
---|
Note: See
TracBrowser
for help on using the repository browser.