xsdata.models.mixins module

class xsdata.models.mixins.ElementBase(index=<factory>, ns_map=<factory>)[source]

Bases: object

Base xsd schema model.

Parameters
  • index (int) – Occurrence position inside the definition

  • ns_map (Dict) – Namespaces map to prefixes.

index: int
ns_map: Dict
property class_name

Return the schema element class name.

Return type

str

property default_type

Return the default type if the given element has not specific type.

Return type

DataType

property default_value

Return the default or the fixed attribute value.

Return type

Any

property display_help

Return the display help for this element.

Return type

Optional[str]

property extensions

Return an iterator of all the base types.

Return type

Iterator[str]

property has_children

Return whether or not this element has any children.

Return type

bool

property has_form

Return whether or not this element has the form attribute.

Return type

bool

property is_abstract

Return whether or not this element is defined as abstract.

Return type

bool

property is_attribute

Return whether or not this element is qualified to be a class attribute.

Return type

bool

property is_fixed

Return whether or not this element has a fixed value.

Return type

bool

property is_mixed

Return whether or not this element accepts mixed content value.

Return type

bool

property is_nillable

Return whether or not this element is accepts empty empty values.

Return type

bool

property is_qualified

Return whether or not this element name needs to be referenced with the target namespace.

Return type

bool

property is_ref

Return whether or not this element is a reference to another element.

Return type

bool

property is_wildcard

Return whether or not this element is a wildcard element/attribute.

Return type

bool

property prefix

Return the namespace prefix for this element’s type.

Return type

Optional[str]

property raw_namespace

Return if present the target namespace attribute value.

Return type

Optional[str]

property raw_type

Return if present the type attribute value.

Return type

Optional[str]

property real_name

Return the real name for this element by looking by looking either to the name or ref attribute value.

Raises

SchemaValueError – when instance has no name/ref attribute.

Return type

str

property real_type

Return the real type for this element.

Raises

SchemaValueError – when attribute instance is missing implementation.

Return type

Optional[str]

property substitutions

Return the substitution groups of this element.

Return type

List[str]

get_restrictions()[source]

Return the restrictions dictionary of this element.

Return type

Dict[str, Any]

schema_prefix()[source]

Return the target namespace prefix used in the schema definition if any.

Return type

Optional[str]

children(condition=None)[source]

Iterate over all the ElementBase children of this element that match the given condition if any.

Parameters

condition (Optional[Callable]) –

Return type

Iterator[ElementBase]