gws.lib.xmlx.serializer

XML serializer.

Source code: gws.lib.xmlx.serializer

Module Contents

class gws.lib.xmlx.serializer.Serializer(el: gws.XmlElement, opts: gws.XmlOptions | None)

Serializer of an element tree to a string, used by XmlElement.to_string.

A serializer object is used for one call of to_string.

buf = []
defaultNamespace
ns_renames
ns_stack = []
opts
root
to_string() → str

Serialize the tree.

Returns:

The XML string.

Raises:
  • WriteError – If the tree contains an invalid or prefixed name, or an invalid prefix.

  • NamespaceError – If a namespace is unknown, or one prefix is used for different URIs.