xsdata.formats.dataclass.parsers package¶
Subpackages¶
Submodules¶
Module contents¶
-
class
xsdata.formats.dataclass.parsers.JsonParser(context=<factory>)[source]¶ Bases:
xsdata.formats.bindings.AbstractParserJson parsing and binding for dataclasses.
- Parameters
context (
XmlContext) – Model metadata builder
-
from_path(path, clazz=None)[source]¶ Parse the input file path and return the resulting object tree.
-
parse(source, clazz=None)[source]¶ Parse the JSON input stream and return the resulting object tree.
-
bind_dataclass_union(value, var)[source]¶ Bind data to all possible models and return the best candidate.
-
bind_choice_simple(value, var)[source]¶ Bind data to one of the simple choice types and return the first that succeeds.
-
class
xsdata.formats.dataclass.parsers.XmlParser(config=<factory>, context=<factory>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>)[source]¶ Bases:
xsdata.formats.dataclass.parsers.nodes.NodeParserBind xml nodes to dataclasses with event hooks.
- Parameters
handler (
Type[XmlHandler]) – Xml handler typeemit_cache – Cache for qnames to event names
config (
ParserConfig) –context (
XmlContext) –
-
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.