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, Union, List]]

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 anonymous complex type inside an element.

build_inner_enumeration(parent, obj)[source]

Build an enumeration class from an anonymous restriction with enumeration facet.

static has_anonymous_class(obj)[source]

Check if the attribute element contains anonymous complex type.

Return type

bool

static has_anonymous_enumeration(obj)[source]

Check if the attribute element contains anonymous restriction with enumeration facet.

Return type

bool

static default_value_type(item)[source]
Return type

Optional[str]