XML.to_string

XML.to_string(encoding='utf-8', prettify=False)[source]

Generate a string representation of this XML instance, including all sub-elements.

Parameters
  • encoding (str, optional) – Output encoding (the default is ‘utf-8’)

  • prettify (bool, optional) – Whether the string should add whitespace for legibility. Defaults to False.

Returns

str – String representation of the XML.