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.

  • prettify (bool, optional) – If True, prettify the string representation by adding whitespace and indentation.

Returns

str – String representation of the XML.