xsdata.codegen.models module¶
-
xsdata.codegen.models.
qname
(name, ns_map, default_namespace=None)[source]¶ Create an
lxml.etree.QName
for the given name and namespaces map.Use the default namespace if the prefix is not in the ns_map.
-
class
xsdata.codegen.models.
Restrictions
(required=None, prohibited=None, min_occurs=None, max_occurs=None, min_exclusive=None, min_inclusive=None, min_length=None, max_exclusive=None, max_inclusive=None, max_length=None, total_digits=None, fraction_digits=None, length=None, white_space=None, pattern=None, explicit_timezone=None, nillable=None, sequential=None)[source]¶ Bases:
object
Model representation of a dataclass field validation and type metadata.
- Parameters
-
merge
(source)[source]¶ Update properties from another instance.
- Parameters
source (
Restrictions
) –
-
classmethod
from_element
(element)[source]¶ Static constructor from an xsd model.
- Parameters
element (
ElementBase
) –- Return type
-
class
xsdata.codegen.models.
AttrType
(name, index=<factory>, alias=None, native=False, forward=False, circular=False)[source]¶ Bases:
object
Model representation for the typing information for fields and extensions.
- Parameters
-
property
is_dependency
¶ Return true if attribute is not a forward/circular references and it’s not a native python time.
- Return type
-
property
native_name
¶ Return the python build-in type name: ‘str’, ‘int’ if it’s native type.
-
class
xsdata.codegen.models.
Attr
(tag, name, index, local_name=None, default=None, fixed=False, types=<factory>, display_type=None, namespace=None, help=None, restrictions=<factory>)[source]¶ Bases:
object
Model representation for a dataclass field.
- Parameters
-
default
: Any = None¶
-
types
: List[AttrType]¶
-
restrictions
: Restrictions¶
-
property
is_attribute
¶ Return whether this attribute is derived from an xs:attribute or xs:anyAttribute.
- Return type
-
property
is_enumeration
¶ Return whether this attribute is derived from an xs:enumeration.
- Return type
-
property
is_factory
¶ Return whether this attribute is a list of items or a mapping.
- Return type
-
property
is_group
¶ Return whether this attribute is derived from an xs:group or xs:attributeGroup.
- Return type
-
property
is_nameless
¶ Return whether this attribute has a local name that will be used during parsing/serialization.
- Return type
-
property
is_suffix
¶ Return whether this attribute is not derived from an xs element with mode suffix.
- Return type
-
property
is_xsi_type
¶ Return whether this attribute qualified name is equal to xsi:type.
- Return type
-
property
is_wildcard
¶ Return whether this attribute is derived from xs:anyAttribute or xs:any.
- Return type
-
class
xsdata.codegen.models.
Extension
(type, restrictions)[source]¶ Bases:
object
Model representation of a dataclass base class.
- Parameters
type (
AttrType
) –restrictions (
Restrictions
) –
- Restrictions type
-
type
: AttrType¶
-
restrictions
: Restrictions¶
-
class
xsdata.codegen.models.
Status
(value)[source]¶ Bases:
enum.IntEnum
An enumeration.
-
RAW
= 0¶
-
PROCESSING
= 1¶
-
PROCESSED
= 2¶
-
-
class
xsdata.codegen.models.
Class
(name, type, module, mixed, abstract, nillable, strict_type=False, status=<Status.RAW: 0>, container=None, package=None, namespace=None, help=None, substitutions=<factory>, extensions=<factory>, attrs=<factory>, inner=<factory>, ns_map=<factory>, source_namespace=None)[source]¶ Bases:
object
Model representation of a dataclass with fields, base/inner classes and additional metadata settings.
- Parameters
-
type
: Type¶
-
status
: xsdata.codegen.models.Status = 0¶
-
extensions
: List[Extension]¶
-
attrs
: List[Attr]¶
-
inner
: List[‘Class’]¶
-
ns_map
: Dict¶
-
property
is_complex
¶ Return whether or not this instance is derived from an xs:element or xs:complexType.
- Return type
-
property
is_element
¶ Return whether or not this instance is derived from an non abstract xs:element.
- Return type
-
property
is_enumeration
¶ Return whether all attributes are derived from xs:enumeration.
- Return type
-
property
source_prefix
¶ Return the source namespace prefix as it was defined in the schema definition.