xsdata.formats.dataclass.parsers package¶
Subpackages¶
Submodules¶
Module contents¶
-
class
xsdata.formats.dataclass.parsers.
JsonParser
(context=<factory>)[source]¶ Bases:
xsdata.formats.bindings.AbstractParser
Json parsing and binding for dataclasses.
- Parameters
context (
XmlContext
) – Model metadata builder
-
parse
(source, clazz)[source]¶ Parse the JSON input stream and return the resulting object tree.
- Parameters
source (
BytesIO
) –clazz (
Type
[~T]) –
- Return type
~T
-
parse_context
(data, clazz)[source]¶ Recursively build the given model from the input dict data.
- Raises
ParserError – When parsing fails for any reason
- Parameters
- Return type
~T
-
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.NodeParser
Bind 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.