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, is_text=False, is_element=False, is_elements=False, is_wildcard=False, is_attribute=False, is_attributes=False, index=<factory>, types=<factory>, namespaces=<factory>, elements=<factory>, wildcards=<factory>)[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

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

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

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

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

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

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

  • index (int) – Field ordering

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

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

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

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

Variables

namespace_matches – Matching cache for the repeatable wildcards

property lname: str

Local name.

Return type

str

property clazz: Optional[Type]

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

Return type

Optional[Type]

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]

match_namespace(qname)[source]

Match the given qname to the wildcard allowed namespaces.

Parameters

qname (str) –

Return type

bool