calculate_attribute_paths
xsdata.codegen.handlers.calculate_attribute_paths
CalculateAttributePaths
Bases: HandlerInterface
Calculate min/max occurs and sequence/choice/group from the schema path.
Source code in xsdata/codegen/handlers/calculate_attribute_paths.py
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
process(target)
classmethod
Calculating the class attrs restrictions by their schema path.
For each attr calculate the min/max occurs and set the sequence/choice/group reference id. Ignore attrs derived from xs:attribute and xs:enumeration as these are not affected by the parent element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | Class | The target class instance | required |
Source code in xsdata/codegen/handlers/calculate_attribute_paths.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
process_attr_path(attr)
classmethod
Entrypoint for processing a class attr.
Example path
("s", 1, 1, 1), ("s", 2, 1, 2), ("c", 3, 0, 10) -> sequence:1 with min=1 and max_occurs=1 sequence:2 with min=1 and max_occurs=2 choice:3 with min=0 and max_occurs=10
Steps
- Every attr starts with a min/max occurs equal to one.
- For every parent container multiply the min/max occurs
- Set the sequence/choice/group reference ids as you go along
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attr | Attr | The attr of the class to check and process | required |
Source code in xsdata/codegen/handlers/calculate_attribute_paths.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|