xsdata.builder module¶
-
class
xsdata.builder.
ClassBuilder
(schema, redefine=None)[source]¶ Bases:
object
-
schema
: Schema = None¶
-
redefine
: Optional[xsdata.models.elements.Redefine] = None¶
-
target_prefix
: Optional[str] = None¶
-
build_class_attributes
(obj, instance)[source]¶ Build the instance class attributes from the given ElementBase children.
-
build_class_extensions
(obj, instance)[source]¶ Build the item class extensions from the given ElementBase children.
-
element_children
(obj)[source]¶ Recursively find and return all child elements that are qualified to be class attributes.
- Return type
Iterator
[Union
[Attribute
,Element
,Restriction
,Enumeration
,Union
,List
,SimpleType
]]
-
element_namespace
(obj)[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 nsmap
qualified elements returns the schema target namespace
unqualified elements return an empty string
unqualified attributes return None
-
children_extensions
(obj, instance)[source]¶ Recursively find and return all instance’s Extension classes.
If the initial given obj has a type attribute include it in result.
-
build_class_attribute
(instance, obj)[source]¶ Generate and append an attribute instance to the instance class.
- Raises
ValueError – if types list is empty
-
build_class_attribute_types
(instance, obj)[source]¶ Convert real type and anonymous inner elements to an attribute type list.
-
static
has_anonymous_class
(obj)[source]¶ Check if the attribute element contains anonymous complex type.
- Return type
-