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)[source]#
Class field binding metadata.
- Parameters:
index (
int
) – Position index of the variablename (
str
) – Name of the variableqname (
str
) – Namespace-qualified name of the variableinit (
bool
) – Indicates if the field should be included in the constructormixed (
bool
) – Indicates if the field supports mixed content type values.tokens_factory (
Optional
[Callable
]) – Callable factory for tokensderived (
bool
) – Indicates whether parsed values should be wrapped with a generic typeany_type (
bool
) – Indicates if the field supports dynamic value typesprocess_contents (
str
) – Information about processing contentsrequired (
bool
) – Indicates if the field is mandatorynillable (
bool
) – Indicates if the field supports nillable contentsequence (
Optional
[int
]) – Specifies rendering values in sequential modedefault (
Any
) – Default value or factory for the fieldxml_type (
str
) – Type of the XML field (element, attribute, etc.)elements (
Mapping
[str
,XmlVar
]) – Mapping of qualified name-repeatable elementswrapper (
Optional
[str
]) – Name for the wrapper (applies for list types only)
- tokens#
Indicates if the field has associated tokens
- list_element#
Indicates if the field is a list or tuple element
- namespace_matches#
Matching namespaces information
- is_clazz_union#
Indicates if the field is a union of multiple types
- local_name#
Local name extracted from the qualified name
- is_text#
Indicates if the field represents text content
- is_element#
Indicates if the field represents an XML element
- is_elements#
Indicates if the field represents a sequence of XML elements
- is_wildcard#
Indicates if the field represents a wildcard
- is_attribute#
Indicates if the field represents an XML attribute
- is_attributes#
Indicates if the field represents a sequence of XML attributes
- find_value_choice(value, is_class)[source]#
Match and return a choice field that matches the given value.
- 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
- find_clazz_choice(clazz)[source]#
Find the best matching choice for the given class.
- Best Matches:
The class is explicitly defined in a choice types
The class is a subclass of one of the choice types
- find_primitive_choice(value, is_tokens)[source]#
Match and return a choice field that matches the given primitive value.
- __hash__ = None#