xsdata.codegen.transformer module

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

Bases: object

Orchestrate the code generation from a list of sources to the output format.

Parameters
  • print (bool) – Print to stdout the generated output.

  • output (str) – The output type.

  • class_map – The classes generated indexed by the source uri.

  • processed – Index of the already processed uris.

print: bool
output: str
class_map: Dict[str, List[Class]]
processed: List[str]
process(uris, package)[source]

Run main processes.

Parameters
  • uris (List[str]) – list of uris to process

  • package (str) – package name eg foo.bar.xxx

process_schema(uri, namespace=None)[source]

Recursively parse the given schema uri and all the imports and generate a class map indexed with the schema uri.

Parameters
generate_classes(schema)[source]

Convert and return the given schema tree to classes.

Parameters

schema (Schema) –

Return type

List[Class]

static parse_schema(uri, namespace=None)[source]

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

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

Parameters
Return type

Optional[Schema]

static analyze_classes(classes)[source]

Analyzer the given class list and simplify attributes and extensions.

Parameters

classes (List[Class]) –

Return type

List[Class]

count_classes(classes)[source]

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

Parameters

classes (List[Class]) –

Return type

Tuple[int, int]

assign_packages(package)[source]

Group uris by common path and auto assign package names to all classes.

Parameters

package (str) –

classmethod assign_package(classes, package)[source]

Assign the given package to all the classes and their inners.

Parameters