XmlEventWriter

class xsdata.formats.dataclass.serializers.writers.XmlEventWriter(config, output, ns_map=<factory>)[source]

XmlWriter implementation based on native python.

Based on the native python xml.sax.saxutils.XMLGenerator with support for indentation. Converts sax events directly to xml output without storing intermediate result to memory.

Parameters
  • config (SerializerConfig) – Configuration instance

  • output (TextIO) – Output text stream

  • ns_map (Dict) – User defined namespace prefix-URI map

start_tag(qname)[source]

Start tag notification receiver.

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

Parameters

qname (str) – Tag qualified name

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) – Tag qualified name