XmlMeta#

class xsdata.formats.dataclass.models.elements.XmlMeta(clazz, qname, target_qname, nillable, text, choices, elements, wildcards, attributes, any_attributes, wrappers, **kwargs)[source]#

Class binding metadata.

Parameters:
  • clazz (Type) – The binding model

  • qname (str) – The namespace-qualified name

  • target_qname (Optional[str]) – The target namespace-qualified name

  • nillable (bool) – Specifies whether this class supports nillable content

  • text (Optional[XmlVar]) – A text variable

  • choices (Sequence[XmlVar]) – A list of compound variables

  • elements (Mapping[str, Sequence[XmlVar]]) – A mapping of qualified name to sequence of element variables

  • wildcards (Sequence[XmlVar]) – A list of wildcard variables

  • attributes (Mapping[str, XmlVar]) – A mapping of qualified name to attribute variable

  • any_attributes (Sequence[XmlVar]) – A list of wildcard variables

  • wrappers (Mapping[str, Sequence[XmlVar]]) – a mapping of wrapper names to sequences of wrapped variables

namespace#

The target namespace extracted from the qualified name

mixed_content#

Specifies if the class supports mixed content

property element_types: Set[Type]#

Return a unique list of all elements types.

get_element_vars()[source]#

Return a sorted list of the class element variables.

Return type:

List[XmlVar]

get_attribute_vars()[source]#

Return a sorted list of the class attribute variables.

Return type:

List[XmlVar]

get_all_vars()[source]#

Return a sorted list of all the class variables.

Return type:

List[XmlVar]

__eq__(other)#

Implement equality operator.

Return type:

bool

__hash__ = None#
__iter__()#

Implement iteration.

Return type:

Iterator

find_attribute(qname)[source]#

Find an attribute var with the given qname.

Parameters:

qname (str) – The namespace qualified name

Return type:

Optional[XmlVar]

Returns:

The xml var instance or None if there is no match.

find_any_attributes(qname)[source]#

Find a wildcard attribute var that matches the given qname.

Parameters:

qname (str) – The namespace qualified name

Return type:

Optional[XmlVar]

Returns:

The xml var instance or None if there is no match.

find_wildcard(qname)[source]#

Find a wildcard var that matches the given qname.

If the wildcard has choices, attempt to match and return one of them as well.

Parameters:

qname (str) – The namespace qualified name

Return type:

Optional[XmlVar]

Returns:

The xml var instance or None if there is no match.

find_any_wildcard()[source]#

Return the first declared wildcard var.

Return type:

Optional[XmlVar]

Returns:

The xml var instance or None if there are no wildcard vars.

find_children(qname)[source]#

Find all class vars that match the given qname.

Go through the elements, choices and wildcards. Sometimes a class might contain more than one var with the same qualified name. The binding process has to check all of them and see which one to use.

Parameters:

qname (str) – The namespace qualified name

Yields:

An iterator of all the class vars that match the given qname.

Return type:

Iterator[XmlVar]