# XmlVar

class xsdata.formats.dataclass.models.elements.XmlVar(index, name, qname, types, clazz, init, mixed, factory, tokens_factory, format, derived, any_type, process_contents, required, nillable, sequence, default, xml_type, namespaces, elements, wildcards, wrapper=None, **kwargs)

  Class field binding metadata.

  Parameters:

    - 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

    - sequence (`Optional`[`int`]) – 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

    - wrapper (`Optional`[`str`]) – A name for the wrapper. Applies for list types only.

  find_choice(qname)

    Match and return a choice field by its qualified name.

    Return type:

      `Optional`[`XmlVar`]

  find_value_choice(value, is_class)

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

    Return type:

      `Optional`[`XmlVar`]

    Cases:

      - 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

  is_optional(value)

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

    Return type:

      `bool`

  match_namespace(qname)

    Match the given qname to the wildcard allowed namespaces.

    Return type:

      `bool`

  __eq__(other)

    Return self==value.

    Return type:

      `bool`

  __hash__ = None