diff options
-rw-r--r-- | scripts/Makefile | 14 | ||||
-rw-r--r-- | scripts/left-right-schema.rnc | 7 | ||||
-rw-r--r-- | scripts/left-right-schema.rng | 8 | ||||
-rw-r--r-- | scripts/rpki/left_right.py | 2 | ||||
-rw-r--r-- | scripts/rpki/relaxng.py | 7 |
5 files changed, 17 insertions, 21 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index 54461d1a..1a182385 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -1,19 +1,19 @@ # $Id$ -all: samples schemas - -samples: left-right-protocol-samples/.stamp +all: left-right-protocol-samples/.stamp left-right-schema.rng up-down-medium-schema.rng up-down-schema.rng left-right-protocol-samples/.stamp: left-right-protocol-samples.xsl ../docs/left-right-xml xsltproc left-right-protocol-samples.xsl ../docs/left-right-xml touch $@ -schemas: left-right-schema.rng up-down-medium-schema.rng up-down-schema.rng +left-right-schema.rng: left-right-schema.rnc + trang left-right-schema.rnc left-right-schema.rng -.rnc.rng: - trang $< $@ +up-down-medium-schema.rng: up-down-medium-schema.rnc + trang up-down-medium-schema.rnc up-down-medium-schema.rng -.SUFFIXES: .rnc .rng +up-down-schema.rng: up-down-schema.rnc + trang up-down-schema.rnc up-down-schema.rng test: all python xml-parse-test.py diff --git a/scripts/left-right-schema.rnc b/scripts/left-right-schema.rnc index 81667d00..70df19f7 100644 --- a/scripts/left-right-schema.rnc +++ b/scripts/left-right-schema.rnc @@ -3,8 +3,7 @@ # RelaxNG (Compact Syntax) Schema for RPKI left-right protocol. # # libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so -# run the output of this script through a converter like trang to get -# XML syntax. +# run the compact syntax through trang to get XML syntax. default namespace = "http://www.hactrn.net/uris/rpki/left-right-spec/" @@ -121,7 +120,3 @@ } } - -# Local Variables: -# compile-command: "trang left-right-schema.rnc left-right-schema.rng" -# End: diff --git a/scripts/left-right-schema.rng b/scripts/left-right-schema.rng index 443635fd..041e04b4 100644 --- a/scripts/left-right-schema.rng +++ b/scripts/left-right-schema.rng @@ -5,8 +5,7 @@ RelaxNG (Compact Syntax) Schema for RPKI left-right protocol. libxml2 (including xmllint) only groks the XML syntax of RelaxNG, so - run the output of this script through a converter like trang to get - XML syntax. + run the compact syntax through trang to get XML syntax. --> <grammar ns="http://www.hactrn.net/uris/rpki/left-right-spec/" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> @@ -464,8 +463,3 @@ </element> </define> </grammar> -<!-- - Local Variables: - compile-command: "trang left-right-schema.rnc left-right-schema.rng" - End: ---> diff --git a/scripts/rpki/left_right.py b/scripts/rpki/left_right.py index c19cdc45..9e345556 100644 --- a/scripts/rpki/left_right.py +++ b/scripts/rpki/left_right.py @@ -120,7 +120,7 @@ class bsc_elt(base_elt): class parent_elt(base_elt): - attributes = ("self_id", "parent_id", "bsc_link", "repository_link", "peer_contact", "sia_base") + attributes = ("action", "self_id", "parent_id", "bsc_link", "repository_link", "peer_contact", "sia_base") booleans = ("rekey", "reissue", "revoke") peer_ta = None diff --git a/scripts/rpki/relaxng.py b/scripts/rpki/relaxng.py index a4a6c00d..072d7798 100644 --- a/scripts/rpki/relaxng.py +++ b/scripts/rpki/relaxng.py @@ -7,6 +7,13 @@ def relaxng(xml, rng): Validate a chunk of xml against a RelaxNG schema. """ + # We could use either xmllint or jing here, but xmllint is easier. + # How to invoke jing, just in case: + # + # java -jar /usr/local/share/java/classes/jing.jar schema.rng foo.xml + # + # If error messages from xmllint are incomprehensible, try jing too. + i, o = os.popen4(("xmllint", "--noout", "--relaxng", rng, "-")) i.write(xml) i.close() |