mixins
xsdata.codegen.mappers.mixins
RawDocumentMapper
Mixin class for raw json/xml documents.
Source code in xsdata/codegen/mappers/mixins.py
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
build_attr(target, qname, attr_type, parent_namespace=None, tag=Tag.ELEMENT, sequence=0, value=_UNSET)
classmethod
Build an attr for the given class instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Class
|
The target class instance |
required |
qname
|
str
|
The attr qualified name |
required |
attr_type
|
AttrType
|
The attr type instance |
required |
parent_namespace
|
str | None
|
The parent namespace |
None
|
tag
|
str
|
The attr tag |
ELEMENT
|
sequence
|
int
|
The attr sequence number |
0
|
value
|
Any
|
The attr sample value |
_UNSET
|
Source code in xsdata/codegen/mappers/mixins.py
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 | |
build_attr_type(qname, value)
classmethod
Build an attribute type for the given attribute name and value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qname
|
str
|
The attr qualified name |
required |
value
|
Any
|
The attr value |
required |
Returns:
| Type | Description |
|---|---|
AttrType
|
The new attr type instance. |
Source code in xsdata/codegen/mappers/mixins.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
select_namespace(namespace, parent_namespace, tag=Tag.ELEMENT)
classmethod
Select the namespace based on the tag and namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
The current namespace |
required |
parent_namespace
|
str | None
|
The parent namespace |
required |
tag
|
str
|
The tag name |
ELEMENT
|
Returns:
| Type | Description |
|---|---|
str | None
|
Optional[str]: The selected namespace. |
Source code in xsdata/codegen/mappers/mixins.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
add_attribute(target, attr)
classmethod
Add an attr to the target class instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Class
|
The target class instance |
required |
attr
|
Attr
|
The attribute to be added. |
required |
Source code in xsdata/codegen/mappers/mixins.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |