O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required