parser – XML Parser Module¶
- class lazyxml.parser.Parser(**kw)¶
XML Parser
- set_options(**kw)¶
Set Parser options.
See also
kw argument have the same meaning as in lazyxml.loads()
- get_options()¶
Get Parser options.
- xml2dict(content)¶
Convert xml content to dict.
Warning
DEPRECATED: xml2dict() is deprecated. Please use xml2object() instead.
Deprecated since version 1.2.
- xml2object(content)¶
Convert xml content to python object.
Parameters: content – xml content Return type: dict New in version 1.2.
- xml_filter(content)¶
Filter and preprocess xml content
Parameters: content – xml content Return type: str
- guess_xml_encoding(content)¶
Guess encoding from xml header declaration.
Parameters: content – xml content Return type: str or None
- strip_xml_header(content)¶
Strip xml header
Parameters: content – xml content Return type: str
- get_node(element)¶
Parse element tag info.
Parse element and get the element tag info. Include tag name, value, attribute, namespace.
Parameters: element – an Element instance Return type: dict
- split_namespace(tag)¶
Split tag namespace.
Parameters: tag – tag name Returns: a pair of (namespace, tag) Return type: tuple