xsdata.formats.dataclass.serializers.writers package

Submodules

Module contents

class xsdata.formats.dataclass.serializers.writers.LxmlEventWriter(output, encoding='UTF-8', pretty_print=False, ns_map=<factory>)[source]

Bases: xsdata.formats.dataclass.serializers.mixins.XmlWriter

Parameters
handler: lxml.sax.ElementTreeContentHandler
write(events)[source]

Iterate over the generated events and feed the sax content handler with the information needed to generate the xml output.

Parameters

events (Generator) –

class xsdata.formats.dataclass.serializers.writers.XmlEventWriter(output, encoding='UTF-8', pretty_print=False, ns_map=<factory>)[source]

Bases: xsdata.formats.dataclass.serializers.mixins.XmlWriter

Parameters
handler: xml.sax.saxutils.XMLGenerator
depth: int = 0
ended: int = 0
start_tag(qname)[source]

Start tag notification receiver.

The receiver will flush any pending start element create new namespaces context and queue the current tag for generation.

Parameters

qname (str) –

end_tag(qname)[source]

End tag notification receiver.

The receiver will flush if pending the start of the element, end the element, its tail content and its namespaces prefix mapping and current context.

Parameters

qname (str) –