obspy.core.util.xmlwrapper.tostring

tostring(element, xml_declaration=True, encoding='utf-8', pretty_print=False, __etree=<module 'lxml.etree' from '/home/megies/local/lib/python2.7/site-packages/lxml/etree.so'>)[source]

Generates a string representation of an XML element, including all subelements.

Parameters:
  • element Element instance.
  • xml_declaration (bool, optional) Adds a XML declaration.. Defaults to True.
  • encoding (str, optional) output encoding. Defaults to ‘‘“utf-8”’‘. Note that changing the encoding to a non UTF-8 compatible encoding will enable a declaration by default.
  • pretty_print (bool, optional) Enables formatted XML. Defaults to False.
Returns:

Encoded string containing the XML data.

This Page