The PyXML package contains over 200 individual modules, some intended
for public use and some not. Many of these modules often perform
similar tasks, making it difficult to figure out which is the right
one to use in any given situation, and this can make it confusing.
Here's a list of the 30-odd packages and modules that are considered
public, along with brief descriptions to help you choose the right
one.
- xml.dom
- The Python DOM interface. The full interface
support DOM Levels 1 and 2. xml.dom contains
the implementation for DOM trees built from XML documents.
(This implementation is called 4DOM, and was written by Fourthought Inc.)
- dom.html
- DOM trees built from HTML documents are also supported.
- dom.javadom
- An adaptor for using Java DOM implementations with Jython.
- dom.minidom
- A lightweight DOM implementation that's also included in the Python
standard library.
- dom.minitraversal
- Offers traversal and ranges on top of
xml.dom.minidom, using the 4DOM traversal implementation.
- dom.pulldom
- Provides a stream of DOM elements. This module can make it easy
to write certain types of DTD-specific processing code.
- dom.ext
- Various DOM-related extensions for pretty-printing DOM trees as XML or XHTML.
- dom.ext.Dom2Sax
- A parser to generate SAX events from a DOM tree.
- dom.ext.c14n
- Takes a DOM tree and outputs a text stream containing the
Canonical XML representation of the document.
- dom.ext.reader
- Classes for building DOM trees from various input sources:
SAX1 and SAX2 parsers, htmllib, and directly using Expat.
- xml.marshal.generic
- Marshals simple Python data types into an XML format. The
Marshaller and Unmarshaller classes can be
subclassed in order to implement marshalling into a different XML
DTD.
- xml.marshal.wddx
- Marshals Python objects into WDDX. (This module is built on top
of the preceding generic module.)
- xml.ns
- Contains constants for the namespace URIs for various XML-related standards.
- xml.parsers.sgmllib
- A version of the sgmllib module that's part of the standard
Python library, rewritten to run on top of the sgmlop
accelerator module.
- xml.parsers.xmlproc
- A validating XML parser. Usually you'll want to use xmlproc via SAX or
some other higher-level interface.
- xml.sax
- SAX1 and SAX2 support for Python.
- sax.drivers
- SAX1 drivers for various parsers: htmllib,
LT, Expat, sgmllib, xmllib, xmlproc,
and XML-Toolkit.
- sax.drivers2
- SAX2 drivers for various parsers: htmllib, Java SAX parsers
(for Jython), Expat, sgmllib, xmlproc.
- sax.handler
- Contains the core SAX2 handler classes ContentHandler,
DTDHandler, EntityResolver, and
ErrorHandler. Also contains symbolic names for the various
SAX2 features and properties.
- sax.sax2exts
- SAX2 extensions. This contains various factory classes that create
parser objects, and is how SAX2 parsers are used.
- sax.saxlib
- Contains two SAX2 handler classes, DeclHandler and
LexicalHandler, and the XMLFilter interface.
Also contains the deprecated SAX1 handler classes.
- sax.saxutils
- Various utility classes, such as DefaultHandler, a default
base class for SAX2 handlers, ErrorPrinter and
ErrorRaiser, two default error handlers, and
XMLGenerator, which generates XML output from a SAX2 event stream.
- sax.xmlreader
- Contains the XMLReader, the base interface for implementing
SAX2 parsers.
- xml.schema.trex
- A Python implementation of TREX, a schema language.
- xml.utils.characters
- Contains the legal XML character ranges as specified in the XML 1.0
Recommendation, and regular expressions that match various
XML tokens.
- xml.utils.iso8601
- Parses ISO-8601 date/time specifiers, which look like
"2002-05-09T20:40Z".
- xml.utils.qp_xml
- A simple tree-based XML parsing interface.
- xml.xpath
- An XPath parser and evaluator.
(This implementation is called 4XPath, and was written by Fourthought Inc.)