RPKI Engine
1.0
|
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 38 of file xml_utils.py.
def rpki::xml_utils::sax_handler::__init__ | ( | self | ) |
Initialize SAX handler.
Definition at line 53 of file xml_utils.py.
def rpki::xml_utils::sax_handler::characters | ( | self, | |
content | |||
) |
Accumulate a chuck of element content (text).
Definition at line 73 of file xml_utils.py.
References text.
def rpki::xml_utils::sax_handler::create_top_level | ( | self, | |
name, | |||
attrs | |||
) |
Handle top-level PDU for this protocol.
Definition at line 125 of file xml_utils.py.
References rpki::publication::sax_handler::name, rpki::up_down::sax_handler::name, rpki::left_right::sax_handler::name, rpki::rootd::sax_handler::pdu, irbe_cli::left_right_sax_handler::pdu, irbe_cli::publication_sax_handler::pdu, rpki::publication::sax_handler::pdu, rpki::up_down::sax_handler::pdu, rpki::left_right::sax_handler::pdu, rpki::manifest::Manifest::version, rpki::roa::RouteOriginAttestation::version, rpki::http::http_message::version, rpki::publication::msg::version, rpki::publication::sax_handler::version, rpki::xml_utils::msg::version, rpki::up_down::message_pdu::version, rpki::up_down::sax_handler::version, rpki::left_right::msg::version, and rpki::left_right::sax_handler::version.
def rpki::xml_utils::sax_handler::endElement | ( | self, | |
name | |||
) |
Handle endElement() events. Mostly this means handling any accumulated element text.
Definition at line 107 of file xml_utils.py.
Referenced by endElementNS().
def rpki::xml_utils::sax_handler::endElementNS | ( | self, | |
name, | |||
qname | |||
) |
Redirect endElementNS() events to endElement().
Definition at line 67 of file xml_utils.py.
References rpki::up_down::base_elt::endElement(), endElement(), rpki::up_down::certificate_elt::endElement(), rpki::publication::publication_object_elt::endElement(), rpki::up_down::class_elt::endElement(), rpki::up_down::issue_pdu::endElement(), and rpki::up_down::error_response_pdu::endElement().
def rpki::xml_utils::sax_handler::saxify | ( | cls, | |
elt | |||
) |
Create a one-off SAX parser, parse an ETree, return the result.
Definition at line 117 of file xml_utils.py.
References result, and rpki::adns::getaddrinfo::result.
Referenced by rpki::x509::XML_CMS_object::unwrap().
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 79 of file xml_utils.py.
Referenced by startElementNS().
def rpki::xml_utils::sax_handler::startElementNS | ( | self, | |
name, | |||
qname, | |||
attrs | |||
) |
Redirect startElementNS() events to startElement().
Definition at line 61 of file xml_utils.py.
References rpki::up_down::base_elt::startElement(), startElement(), rpki::publication::config_elt::startElement(), rpki::up_down::certificate_elt::startElement(), rpki::up_down::class_elt::startElement(), rpki::up_down::class_response_syntax::startElement(), rpki::up_down::issue_pdu::startElement(), rpki::up_down::revoke_syntax::startElement(), rpki::up_down::message_pdu::startElement(), rpki::left_right::list_resources_elt::startElement(), and rpki::left_right::list_roa_requests_elt::startElement().
Definition at line 89 of file xml_utils.py.
Referenced by saxify().
Definition at line 55 of file xml_utils.py.
Referenced by endElement().
Definition at line 55 of file xml_utils.py.
Referenced by characters(), and endElement().