XmlParser¶
-
class
xsdata.formats.dataclass.parsers.
XmlParser
(config=<factory>, context=<factory>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>)[source]¶ Xml parser for dataclasses.
- Parameters
config (
ParserConfig
) – Parser configurationcontext (
XmlContext
) – Model context providerhandler (
Type
[XmlHandler
]) – Override default XmlHandler
- Variables
ms_map – The prefix-URI map generated during parsing
emit_cache – Qname to event name cache
-
handler
¶ alias of
xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler
-
start
(clazz, queue, objects, qname, attrs, ns_map)[source]¶ Start element notification receiver.
Build and queue the XmlNode for the starting element and emits and propagate the event to subclasses.
- Parameters
clazz (
Optional
[Type
]) – Root class type, if it’s missing look for any suitable models from the current context.queue (
List
[XmlNode
]) – The active XmlNode queueobjects (
List
[Tuple
[Optional
[str
],Any
]]) – The list of all intermediate parsed objectsqname (
str
) – Qualified nameattrs (
Dict
) – Attribute key-value mapns_map (
Dict
) – Namespace prefix-URI map
-
end
(queue, objects, qname, text, tail)[source]¶ End element notification receiver.
Pop the last XmlNode from the queue and use it to build and return the resulting object tree with its text and tail content. Propagate the event to subclasses.