xml.dom.InvalidStateErr

exception xml.dom.InvalidStateErr Raised when an attempt is made to use an object that is not defined or is no longer usable.

xml.dom.minidom.Node.toprettyxml()

Node.toprettyxml(indent="", newl="", encoding="") Return a pretty-printed version of the document. indent specifies the indentation string and defaults to a tabulator; newl specifies the string emitted at the end of each line and defaults to \n. The encoding argument behaves like the corresponding argument of toxml().

xml.dom.minidom.parse()

xml.dom.minidom.parse(filename_or_file, parser=None, bufsize=None) Return a Document from the given input. filename_or_file may be either a file name, or a file-like object. parser, if given, must be a SAX2 parser object. This function will change the document handler of the parser and activate namespace support; other parser configuration (like setting an entity resolver) must have been done in advance.

xml.dom.minidom.parseString()

xml.dom.minidom.parseString(string, parser=None) Return a Document that represents the string. This method creates an io.StringIO object for the string and passes that on to parse().

xml.dom.minidom.Node.unlink()

Node.unlink() Break internal references within the DOM so that it will be garbage collected on versions of Python without cyclic GC. Even when cyclic GC is available, using this can make large amounts of memory available sooner, so calling this on DOM objects as soon as they are no longer needed is good practice. This only needs to be called on the Document object, but may be called on child nodes to discard children of that node. You can avoid calling this method explicitly by using the wit

xml.dom.minidom.Node.writexml()

Node.writexml(writer, indent="", addindent="", newl="") Write XML to the writer object. The writer should have a write() method which matches that of the file object interface. The indent parameter is the indentation of the current node. The addindent parameter is the incremental indentation to use for subnodes of the current one. The newl parameter specifies the string to use to terminate newlines. For the Document node, an additional keyword argument encoding can be used to specify the enc

xml.dom.InvalidAccessErr

exception xml.dom.InvalidAccessErr Raised if a parameter or an operation is not supported on the underlying object.

xml.dom.IndexSizeErr

exception xml.dom.IndexSizeErr Raised when an index or size parameter to a method is negative or exceeds the allowed values.

xml.dom.InvalidModificationErr

exception xml.dom.InvalidModificationErr Raised when an attempt is made to modify the type of a node.

xml.dom.InvalidCharacterErr

exception xml.dom.InvalidCharacterErr This exception is raised when a string parameter contains a character that is not permitted in the context it’s being used in by the XML 1.0 recommendation. For example, attempting to create an Element node with a space in the element type name will cause this error to be raised.