aboutsummaryrefslogtreecommitdiff
path: root/scripts/rpki/relaxng.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-08-03 15:27:57 +0000
committerRob Austein <sra@hactrn.net>2007-08-03 15:27:57 +0000
commit7ed3ca7909edc5bc5f755770c860babf3ab36d52 (patch)
treee133d4e5d7e9863b72792b8bfbd089d0d68aaf01 /scripts/rpki/relaxng.py
parent950d2c29633ba4bcbc6dc19107aa9f4679f5f474 (diff)
Checkpoint
svn path=/scripts/irbe-cli.py; revision=823
Diffstat (limited to 'scripts/rpki/relaxng.py')
-rw-r--r--scripts/rpki/relaxng.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/rpki/relaxng.py b/scripts/rpki/relaxng.py
new file mode 100644
index 00000000..bbfc6d72
--- /dev/null
+++ b/scripts/rpki/relaxng.py
@@ -0,0 +1,24 @@
+# $Id$
+
+import lxml.etree
+
+class RelaxNG(lxml.etree.RelaxNG):
+ """
+ Minor customizations of lxml.etreeRelaxNG.
+ """
+
+ def __init__(self, filename):
+ """
+ Initialize a RelaxNG validator from a file.
+ """
+ lxml.etree.RelaxNG.__init__(self, lxml.etree.parse(filename))
+
+ def assertValid(self, doc):
+ """
+ Provide a bit more information on validation failures.
+ """
+ try:
+ lxml.etree.RelaxNG.assertValid(self, doc)
+ except lxml.etree.DocumentInvalid:
+ print self.error_log.last_error
+ raise