xsdata.transformer module

class xsdata.transformer.SchemaTransformer(print, output)[source]

Bases: object

print: bool = None
output: str = None
processed: List[Path] = None
process(schema_path, package)[source]
process_schema(schema_path, package, target_namespace=None)[source]

Recursively parse the given schema and all it’s included schemas and generate a list of classes.

Return type

List[Class]

process_included(included, package, target_namespace)[source]

Prepare the given included schema location and send it for processing.

Return type

List[Class]

generate_classes(schema, package)[source]

Convert the given schema tree to codegen classes and use the writer factory to either generate or print the result code.

static parse_schema(schema_path, target_namespace)[source]

Parse the given schema path and return the schema tree object.

Optionally add the target namespace if the schema is included and is missing a target namespace.

Return type

Schema

static analyze_classes(classes)[source]

Analyzer the given class list and simplify attributes and extensions.

static adjust_package(package, location)[source]

Adjust if possible the package name relatively to the schema location to make sense.

eg. foo.bar, ../common/schema.xsd -> foo.common

Return type

str

count_classes(classes)[source]

Return a tuple of counters for the main and inner classes.