xsdata.codegen.mappers.schema module¶
-
class
xsdata.codegen.mappers.schema.SchemaMapper[source]¶ Bases:
objectMap a schema instance to classes, extensions and attributes.
-
classmethod
root_elements(schema)[source]¶ Return all valid schema elements that can be converted to classes.
- Parameters
schema (
Schema) –
-
classmethod
build_class(obj, container, module, target_namespace)[source]¶ Build and return a class instance.
-
classmethod
build_substitutions(obj, target_namespace)[source]¶ - Parameters
obj (
ElementBase) –
- Return type
-
classmethod
build_class_attributes(obj, target)[source]¶ Build the target class attributes from the given ElementBase children.
- Parameters
obj (
ElementBase) –target (
Class) –
-
classmethod
build_class_extensions(obj, target)[source]¶ Build the item class extensions from the given ElementBase children.
- Parameters
obj (
ElementBase) –target (
Class) –
-
classmethod
build_data_type(target, name, index=0, forward=False)[source]¶ Create an attribute type for the target class.
-
classmethod
element_children(obj, restrictions)[source]¶ Recursively find and return all child elements that are qualified to be class attributes.
- Parameters
obj (
ElementBase) –restrictions (
Restrictions) –
- Return type
-
classmethod
element_namespace(obj, target_namespace)[source]¶ Return the target namespace for the given schema element.
- In order:
elements/attributes with specific target namespace
prefixed elements returns the namespace from schema ns_map
qualified elements returns the schema target namespace
unqualified elements return an empty string
unqualified attributes return None
- Parameters
obj (
ElementBase) –
- Return type
-
classmethod
children_extensions(obj, target)[source]¶ Recursively find and return all target’s Extension classes.
If the initial given obj has a type attribute include it in result.
- Parameters
obj (
ElementBase) –target (
Class) –
- Return type
-
classmethod
build_class_extension(target, name, index, restrictions)[source]¶ Create an extension for the target class.
-
classmethod
build_class_attribute(target, obj, parent_restrictions)[source]¶ Generate and append an attribute field to the target class.
- Parameters
target (
Class) –obj (
ElementBase) –parent_restrictions (
Restrictions) –
-
classmethod
build_class_attribute_types(target, obj)[source]¶ Convert real type and anonymous inner types to an attribute type list.
- Parameters
target (
Class) –obj (
ElementBase) –
- Return type
-
classmethod
build_inner_classes(obj, module, namespace)[source]¶ Find and convert anonymous types to a class instances.
-
classmethod
is_class(item)[source]¶ - Parameters
item (
ElementBase) –- Return type
-
classmethod