xml.dom.minidom

The xml.dom.minidom module provides a simple parser for creating DOM trees.

parse(file [, parser])

Parses the contents of file and returns a Document node representing the top of the document tree. file is a filename or an already-open file object. parser is an optional SAX2-compatible parser object that will be used to construct the tree. If omitted, a default parser will be used.

parseString(string [, parser])

The same as parse(), except that the input data is supplied in a string instead of a file.

Both of these parsing methods return the top node of a DOM tree. The tree can be traversed using the standard attributes and methods for nodes described in the xml.dom module. The xml.dom.minidom module adds a few additional methods ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.