class xsdata.formats.dataclass.models.elements.XmlVar(index, name, qname, types, clazz, init, mixed, factory, tokens_factory, format, derived, any_type, required, nillable, sequential, default, xml_type, namespaces, elements, wildcards, **kwargs)[source]#

Class field binding metadata.

  • index (int) – Field ordering

  • name (str) – Field name

  • qname (str) – Qualified name

  • types (Sequence[Type]) – List of all the supported data types

  • init (bool) – Include field in the constructor

  • mixed (bool) – Field supports mixed content type values

  • tokens – Field is derived from xs:list

  • format (Optional[str]) – Value format information

  • derived (bool) – Wrap parsed values with a generic type

  • any_type (bool) – Field supports dynamic value types

  • required (bool) – Field is mandatory

  • nillable (bool) – Field supports nillable content

  • sequential (bool) – Render values in sequential mode

  • list_element – Field is a list of elements

  • default (Any) – Field default value or factory

  • xml_Type – Field xml type

  • namespaces (Sequence[str]) – List of the supported namespaces

  • elements (Mapping[str, XmlVar]) – Mapping of qname-repeatable elements

  • wildcards (Sequence[XmlVar]) – List of repeatable wildcards


Match and return a choice field by its qualified name.

Return type:


find_value_choice(value, is_class)[source]#

Match and return a choice field that matches the given value.

Return type:


  • value is none or empty tokens list: look for a nillable choice

  • value is a dataclass: look for exact type or a subclass

  • value is primitive: test value against the converter


Return whether this var instance is not required and the given value matches the default one.

Return type:



Match the given qname to the wildcard allowed namespaces.

Return type:



Return self==value.

Return type:


__hash__ = None#