bindings
xsdata.formats.bindings
AbstractSerializer
Bases: ABC
Abstract serializer class.
Source code in xsdata/formats/bindings.py
9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
render(obj)
abstractmethod
Serialize the input model instance to the output string format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj | Any | The input model instance to serialize | required |
Returns:
Type | Description |
---|---|
str | The serialized string output format. |
Source code in xsdata/formats/bindings.py
12 13 14 15 16 17 18 19 20 21 |
|
AbstractParser
Bases: ABC
Abstract parser class.
Source code in xsdata/formats/bindings.py
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 |
|
from_path(path, clazz=None)
Parse the input file into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to the input file | required |
clazz | Optional[Type[T]] | The target class type to parse the file into | None |
Returns:
Type | Description |
---|---|
T | An instance of the specified class representing the parsed content. |
Source code in xsdata/formats/bindings.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
from_string(source, clazz=None)
Parse the input source string into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source | str | The source string to parse | required |
clazz | Optional[Type[T]] | The target class type to parse the source string into | None |
Returns:
Type | Description |
---|---|
T | An instance of the specified class representing the parsed content. |
Source code in xsdata/formats/bindings.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
from_bytes(source, clazz=None)
Parse the input source bytes object into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source | bytes | The source bytes object to parse | required |
clazz | Optional[Type[T]] | The target class type to parse the source bytes object | None |
Returns:
Type | Description |
---|---|
T | An instance of the specified class representing the parsed content. |
Source code in xsdata/formats/bindings.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
parse(source, clazz=None)
abstractmethod
Parse the input file or stream into the target class type.
If no clazz is provided, the binding context will try to locate it from imported dataclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source | Any | The source stream object to parse | required |
clazz | Optional[Type[T]] | The target class type to parse the source bytes object | None |
Returns:
Type | Description |
---|---|
T | An instance of the specified class representing the parsed content. |
Source code in xsdata/formats/bindings.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|