XmlVar

class xsdata.formats.dataclass.models.elements.XmlVar(name, qname, init=True, mixed=False, tokens=False, format=None, derived=False, any_type=False, nillable=False, dataclass=False, sequential=False, list_element=False, default=None, text=False, element=False, elements=False, wildcard=False, attribute=False, attributes=False, types=<factory>, choices=<factory>, namespaces=<factory>, xml_type=None)[source]

Dataclass field binding metadata.

Parameters
  • name (str) – Field name

  • qname (str) – Qualified name

  • init (bool) – Include field in the constructor

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

  • tokens (bool) – Field is derived from xs:list

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

  • derived (bool) – Wrap parsed values with DerivedElement

  • any_type (bool) – Field supports dynamic value types

  • nillable (bool) – Field supports nillable content

  • dataclass (bool) – Field value is bound to a dataclass

  • sequential (bool) – Render values in sequential mode

  • list_element (bool) – Field is a list of elements

  • default (Optional[Any]) – Field default value or factory

  • text (bool) – Field is derived from xs:simpleType

  • element (bool) – Field is derived from xs:element

  • elements (bool) – Field is derived from xs:choice

  • wildcard (bool) – Field is derived from xs:anyType

  • attribute (bool) – Field is derived from xs:attribute

  • attributes (bool) – Field is derived from xs:attributes

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

  • choices (List[XmlVar]) – List of repeatable choice elements

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

  • xml_type (Optional[InitVar]) –

property lname

Local name.

Return type

str

property clazz

Return the first type if field is bound to a dataclass.

Return type

Optional[Type]

matches(qname)[source]

Match the field qualified local name to the given qname.

Return True automatically if the local name is a wildcard.

Parameters

qname (str) –

Return type

bool

matches_choice(qname)[source]

Return whether a choice element matches the given qualified name.

Parameters

qname (str) –

Return type

bool

find_choice(qname)[source]

Match and return a choice field by its qualified name.

Parameters

qname (str) –

Return type

Optional[XmlVar]

find_value_choice(value)[source]

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

Parameters

value (Any) –

Return type

Optional[XmlVar]

find_type_choice(tp, tokens, check_subclass)[source]

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

Parameters
Return type

Optional[XmlVar]

matches_wildcard(qname)[source]

Match the given qname to the wildcard allowed namespaces.

Parameters

qname (str) –

Return type

bool