flatten_attribute_groups
xsdata.codegen.handlers.flatten_attribute_groups
FlattenAttributeGroups
Bases: RelativeHandlerInterface
Replace groups and attGroups with the source class attributes.
Source code in xsdata/codegen/handlers/flatten_attribute_groups.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
process(target)
Iterate over all group attributes and apply handler logic.
Group attributes can refer to attributes or other group attributes, repeat until there is no group attribute left.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance to inspect and process | required |
Source code in xsdata/codegen/handlers/flatten_attribute_groups.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
process_attribute(target, attr)
Process a group/attributeGroup attr.
Steps
- Find the source class by the attr type and tag
- If the attr is circular reference, remove the attr
- Otherwise, copy all source attrs to the target class
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
attr | Attr | The group attr to flatten | required |
Raises:
Type | Description |
---|---|
AnalyzerValueError | if source class is not found. |
Source code in xsdata/codegen/handlers/flatten_attribute_groups.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|