xsdata.codegen.handlers.attribute_substitution module

class xsdata.codegen.handlers.attribute_substitution.AttributeSubstitutionHandler(container)[source]

Bases: xsdata.codegen.mixins.HandlerInterface

Apply substitution attributes to the given class recursively.

Parameters

container (ContainerInterface) –

container: ContainerInterface
substitutions: Optional[Dict[lxml.etree.QName, List[xsdata.codegen.models.Attr]]] = None
process(target)[source]

Search and process attributes not derived from xs:enumeration or xs:any.

Build the substitutions map if it’s not initialized yet.

Parameters

target (Class) –

process_attribute(target, attr)[source]

Check if the given attribute matches any substitution class in order to clone it’s attributes to the target class.

The cloned attributes are placed below the attribute the are supposed to substitute.

Parameters
create_substitutions()[source]

Create reference attributes for all the classes substitutions and group them by their fully qualified name.

classmethod create_substitution(source, qname)[source]

Create an attribute with type that refers to the given source class and namespaced qualified name.

Parameters
  • source (Class) –

  • qname (QName) –

Return type

Attr