xsdata.builder module

class xsdata.builder.ClassBuilder(schema)[source]

Bases: object

schema: Schema = None
target_prefix: Optional[str] = None
build()[source]

Generate classes from schema elements.

Return type

List[Class]

build_class(obj, inner=False)[source]

Build and return a class instance.

Return type

Class

build_class_attributes(obj, item)[source]
build_class_extensions(obj)[source]

Return a sorted, filtered list of extensions.

Return type

List[Extension]

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]]

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.

Return type

Iterator[Extension]

build_class_attribute(parent, obj)[source]

Generate and append an attribute instance to the parent class.

Skip if no real type could be detected because of an invalid schema or missing implementation.

build_inner_class(parent, obj)[source]

Build a class from an Element complex type and append it to the parent inner class list.

Assign the element name to the complex type name and to the element type.

static has_inner_type(obj)[source]

Detect and return if an element instance has inner reference to a complex type.

Generate and append the inner class to the parent class.

Return type

bool

static default_value_type(item)[source]
Return type

Optional[str]