Markup Processing Modules

xml.dom.minidom

A lightweight DOM implementation supporting parsing, node creation and XML serialization. It builds an in-memory document with node relationships. Use unlink() or a context manager to release the document when finished. Use bounded trusted XML; parsing hostile input requires a security review and resource limits.

Formal Syntax & Structure

python syntaxpython
import xml.dom.minidom

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from xml.dom import minidomwith minidom.parseString("<root><name>Ada</name></root>") as doc:    name = doc.getElementsByTagName("name")[0]    print(name.firstChild.data)
Python Reference