pugixml.pugi.BytesWriterΒΆ

class pugixml.pugi.BytesWriter

Bases: XMLWriter

(pugixml-python only) XMLWriter implementation for bytes.

See also

XMLNode.print()

Examples

>>> from pugixml import pugi
>>> doc = pugi.XMLDocument()
>>> doc.append_child('node')
>>> writer = pugi.BytesWriter()
>>> doc.print(writer, flags=pugi.FORMAT_RAW, encoding=pugi.ENCODING_UTF32_BE)
>>> writer.getvalue().decode('utf-32be')
'<node/>'

Members:

__init__(self)

Initialize BytesWriter.

__len__(self)

Return the contents size in bytes.

getvalue(self)

Return the entire contents of the buffer.