xsdata.formats.dataclass.serializers.xml module¶
-
class
xsdata.formats.dataclass.serializers.xml.
XmlSerializer
(name_generator=<function ModelInspect.<lambda>>, cache=<factory>, xml_declaration=True, encoding='UTF-8', pretty_print=False)[source]¶ Bases:
xsdata.formats.bindings.AbstractSerializer
,xsdata.formats.dataclass.mixins.ModelInspect
- Variables
xml_declaration – Add xml declaration
encoding – Result text encoding
pretty_print – Enable pretty output
-
xml_declaration
: bool = True¶
-
encoding
: str = 'UTF-8'¶
-
pretty_print
: bool = False¶
-
render
(obj, namespaces=None)[source]¶ Convert the given object tree to xml string.
Optionally provide a namespaces instance with a predefined list of namespace uris and prefixes.
- Return type
-
render_tree
(obj, namespaces=None)[source]¶ Convert a dataclass instance to a nested Element structure.
Optionally provide a namespaces instance with a predefined list of namespace uris and prefixes.
- Return type
Element