xsdata.formats.dataclass.context module¶
-
class
xsdata.formats.dataclass.context.
XmlContext
(name_generator=<function XmlContext.<lambda>>, cache=<factory>)[source]¶ Bases:
object
Generate and cache the necessary metadata to bind an xml document data to a dataclass model.
- Parameters
-
name_generator
()¶
-
cache
: Dict[Type, XmlMeta]¶
-
fetch
(clazz, parent_ns=None, xsi_type=None)[source]¶ Fetch the model metadata of the given dataclass type, namespace and xsi type.
- Parameters
- Return type
-
find_subclass
(clazz, xsi_type)[source]¶ Find a derived class of the given clazz that matches the given qualified xsi type.
The derived class is either a subclass or shares the same parent class as the given class.
-
match_class_source_qname
(clazz, xsi_type)[source]¶ Match a given source qualified name with the given xsi type.
-
build
(clazz, parent_ns=None)[source]¶ Fetch from cache or build the metadata object for the given class and parent namespace.
-
static
resolve_namespaces
(xml_type, namespace, parent_namespace)[source]¶ Resolve the namespace(s) for the given xml type and the parent namespace.
Only elements and wildcards are allowed to inherit the parent namespace if the given namespace is empty.
In case of wildcard try to decode the ##any, ##other, ##local, ##target.