XML interface

Py2VTK provides a low level interface to XML taylored to write VTK files.

class py2vtk.core.xml.XmlWriter(filepath, addDeclaration=True)

Xml writer class.

Parameters

filepathstr

Path to the xml file.

addDeclarationbool, optional

Whether to add the declaration. The default is True.

addAttributes(newline=False, **kwargs)

Add attributes.

Parameters

newlinebool, default=False

If True, adds a “>” and newline after adding all of the attributes.

kwargsdict

keys as attribute names.

Returns

XmlWriter

The XmlWriter itself for chained calls.

addDeclaration()

Add xml declaration.

addText(text)

Add text.

Parameters

textstr

Text to add.

Returns

XmlWriter

The XmlWriter itself for chained calls.

close()

Close the file.

closeElement(tag=None)

Close the current element.

Parameters

tagstr, optional

Tag of the element. The default is None.

Returns

XmlWriter

The XmlWriter itself for chained calls.

openElement(tag)

Open a new xml element.