Public Member Functions | |
def | __init__ |
def | characters |
def | create_top_level |
def | endElement |
def | endElementNS |
def | saxify |
def | startElement |
def | startElementNS |
Public Attributes | |
result | |
stack | |
text |
SAX handler for RPKI protocols. This class provides some basic amenities for parsing protocol XML of the kind we use in the RPKI protocols, including whacking all the protocol element text into US-ASCII, simplifying accumulation of text fields, and hiding some of the fun relating to XML namespaces. General assumption: by the time this parsing code gets invoked, the XML has already passed RelaxNG validation, so we only have to check for errors that the schema can't catch, and we don't have to play as many XML namespace games.
Definition at line 22 of file xml_utils.py.
def rpki.xml_utils.sax_handler.__init__ | ( | self | ) |
def rpki.xml_utils.sax_handler.characters | ( | self, | ||
content | ||||
) |
def rpki.xml_utils.sax_handler.create_top_level | ( | self, | ||
name, | ||||
attrs | ||||
) |
def rpki.xml_utils.sax_handler.endElement | ( | self, | ||
name | ||||
) |
Handle endElement() events. Mostly this means handling any accumulated element text.
Definition at line 79 of file xml_utils.py.
def rpki.xml_utils.sax_handler.endElementNS | ( | self, | ||
name, | ||||
qname | ||||
) |
def rpki.xml_utils.sax_handler.saxify | ( | cls, | ||
elt | ||||
) |
Create a one-off SAX parser, parse an ETree, return the result.
Definition at line 89 of file xml_utils.py.
def rpki.xml_utils.sax_handler.startElement | ( | self, | ||
name, | ||||
attrs | ||||
) |
Handle startElement() events. We maintain a stack of nested elements under construction so that we can feed events directly to the current element rather than having to pass them through all the nesting elements. If the stack is empty, this event is for the outermost element, so we call a virtual method to create the corresponding object and that's the object we'll be returning as our final result.
Definition at line 53 of file xml_utils.py.
def rpki.xml_utils.sax_handler.startElementNS | ( | self, | ||
name, | ||||
qname, | ||||
attrs | ||||
) |
Definition at line 75 of file xml_utils.py.
Definition at line 39 of file xml_utils.py.
Definition at line 38 of file xml_utils.py.