diff options
author | Rob Austein <sra@hactrn.net> | 2007-09-21 15:22:47 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-09-21 15:22:47 +0000 |
commit | d35d9b2b5a9ab6e1861abc30768a2d8eaea7b310 (patch) | |
tree | 7f9813d3c6049ab93c2c661b7144068e94c4bc70 /scripts/rpki/sax_utils.py | |
parent | 0077617b0281e82928f0460d53cfcd200f4930c9 (diff) |
Simplify SAX calling sequence.
svn path=/scripts/rpki/sax_utils.py; revision=1004
Diffstat (limited to 'scripts/rpki/sax_utils.py')
-rw-r--r-- | scripts/rpki/sax_utils.py | 10 |
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 |