animedex.render.xml
Lossless XML payload adapter.
The adapter converts xml.etree.ElementTree.Element trees into
plain dictionaries without making backend-specific decisions. It is
used by XML-speaking backends such as ANN, while semantic handling
stays in the backend rich-model layer.
XmlInput
TAG_KEY
- animedex.render.xml.TAG_KEY = '_tag'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
ATTRS_KEY
- animedex.render.xml.ATTRS_KEY = '_attrs'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
TEXT_KEY
- animedex.render.xml.TEXT_KEY = '_text'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
TAIL_KEY
- animedex.render.xml.TAIL_KEY = '_tail'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
CHILDREN_KEY
- animedex.render.xml.CHILDREN_KEY = '_children'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
CHILDREN_BY_TAG_KEY
- animedex.render.xml.CHILDREN_BY_TAG_KEY = '_children_by_tag'
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
element_to_dict
- animedex.render.xml.element_to_dict(element: Element) Dict[str, Any][source]
Convert an ElementTree element into a lossless dictionary.
The returned shape preserves element name, attributes, direct text, tail text, ordered children, and grouped children by tag. The ordered child list is authoritative; the grouped map is a convenience index that always stores lists, even for tags that appear once.
- Parameters:
element (xml.etree.ElementTree.Element) – Parsed XML element.
- Returns:
Lossless dictionary representation of
element.- Return type:
xml_text_to_dict
children_by_tag
- animedex.render.xml.children_by_tag(node: Dict[str, Any], tag: str) list[source]
Return grouped child nodes for
tagfrom an adapted node.- Parameters:
node (dict) – Node produced by
element_to_dict().tag (str) – Child element name.
- Returns:
Child nodes with matching tag, in original order.
- Return type: