def pretty_print(self): """A version of the XML document which should be slightly more readable on the command line.""" return etree.tostring(self.entry, pretty_print=True)
def __str__(self): """Export the XML to a bytestring, ready for use""" xml_str = etree.tostring(self.entry) if not xml_str.startswith('<?xml version="1.0"?>'): xml_str = '<?xml version="1.0"?>' + xml_str return xml_str
def to_xml(self): """Convenience method for outputing the DOM as a (byte)string.""" return etree.tostring(self.dom)