xsdata.builder module¶
-
class
xsdata.builder.
ClassBuilder
(schema)[source]¶ Bases:
object
-
schema
: Schema = None¶
-
target_prefix
: Optional[str] = None¶
-
build_class_attributes
(obj, item)[source]¶ Build the target item class attributes from the given obj child elements.
If exists append default value attribute.
-
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
]]
-
element_namespace
(obj)[source]¶ Returns an element’s namespace by its prefix and form.
- Examples:
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
-
element_extensions
(obj, include_current=True)[source]¶ Recursively find and return all parent Extension classes.
If the initial given obj has a type attribute include it in result.
-
build_class_attribute
(parent, obj)[source]¶ Generate and append an attribute instance to the parent class.
- Raises
ValueError – if types list is empty
-
build_class_attribute_types
(parent, obj)[source]¶ Convert real type and anonymous inner elements to an attribute type list.
-
build_inner_class
(obj)[source]¶ Convert anonymous type to class to be appended in the parent inner class list.
-
static
has_anonymous_class
(obj)[source]¶ Check if the attribute element contains anonymous complex type.
- Return type
-