aboutsummaryrefslogtreecommitdiff
path: root/scripts/rpki/sax_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rpki/sax_utils.py')
-rw-r--r--scripts/rpki/sax_utils.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/rpki/sax_utils.py b/scripts/rpki/sax_utils.py
index 06862524..058deeb2 100644
--- a/scripts/rpki/sax_utils.py
+++ b/scripts/rpki/sax_utils.py
@@ -2,7 +2,7 @@
"""SAX utilities."""
-import xml.sax
+import xml.sax, lxml.sax
class handler(xml.sax.handler.ContentHandler):
"""SAX handler for RPKI protocols.
@@ -68,3 +68,11 @@ class handler(xml.sax.handler.ContentHandler):
text = self.text.encode("ascii").strip()
self.text = ""
self.stack[-1].endElement(self.stack, name, text)
+
+ @classmethod
+ def saxify(cls, elt):
+ """Create a one-off SAX parser, parse an ETree, return the result.
+ """
+ self = cls()
+ lxml.sax.saxify(elt, self)
+ return self.result