xsdata.formats.dataclass.parsers.xml module

class xsdata.formats.dataclass.parsers.xml.XmlParser(config=<factory>, context=<factory>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>)[source]

Bases: xsdata.formats.dataclass.parsers.nodes.NodeParser

Bind xml nodes to dataclasses with event hooks.

Parameters
handler

alias of xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler

emit_cache: Dict
start(clazz, queue, objects, qname, attrs, ns_map)[source]

Queue the next xml node for parsing.

Emit a start event with the current element qualified name and attributes.

Parameters
end(queue, objects, qname, text, tail)[source]

Parse the last xml node and bind any intermediate objects.

Emit an end event with the result object if any.

Return type

Any

Returns

The result of the binding process.

Parameters
emit_event(event, name, **kwargs)[source]

Call if exist the parser’s hook for the given element and event.

Parameters
  • event (str) –

  • name (str) –

  • kwargs (Any) –