XmlParser#
- class xsdata.formats.dataclass.parsers.XmlParser(config=<factory>, context=<factory>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.native.XmlEventHandler'>)[source]#
Default Xml parser for data classes.
- Parameters:
config (
ParserConfig
) – The parser config instancecontext (
XmlContext
) – The xml context instancehandler (
Type
[XmlHandler
]) – The xml handler class
- ns_map#
The parsed namespace prefix-URI map
- handler#
alias of
XmlEventHandler
- __eq__(other)#
Return self==value.
- __hash__ = None#
- end(queue, objects, qname, text, tail)#
Parse the last xml node and bind any intermediate objects.
- Parameters:
- Return type:
- Returns:
Whether the binding process was successful.
- from_bytes(source, clazz=None)#
Parse the input source bytes object into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
- from_path(path, clazz=None)#
Parse the input file into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
- from_string(source, clazz=None)#
Parse the input source string into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
- parse(source, clazz=None)#
Parse the input file or stream into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
- register_namespace(prefix, uri)#
Register the uri prefix in the namespace registry.
- start(clazz, queue, objects, qname, attrs, ns_map)#
Build and queue the XmlNode for the starting element.
- Parameters:
clazz (
Optional
[Type
]) – The target class type, auto locate if omittedqueue (
List
[XmlNode
]) – The XmlNode queue listobjects (
List
[Tuple
[Optional
[str
],Any
]]) – The list of all intermediate parsed objectsqname (
str
) – The element qualified nameattrs (
Dict
) – The element attributesns_map (
Dict
) – The element namespace prefix-URI map