2 XML-Related Standards
XML 1.0 is the basic standard, but people have built many, many
additional standards and tools on top of XML or to be used with XML.
This section will quickly introduce some of these related
technologies, paying particular attention to those that are supported
by the Python/XML package.
- SAX
- The Simple API for XML isn't a standard in the formal sense that XML
or ANSI C are. Rather, SAX is an informal specification originally
designed by David Megginson with input from many people on the xml-dev
mailing list. SAX defines an event-driven interface for parsing XML.
To use SAX, you must create Python class instances which implement a
specified interface, and the parser will then call various methods on
those objects. See section 5.
- DOM
- The Document Object Model specifies a tree-based representation for an
XML document, as opposed to the event-driven processing provided by
SAX. See section 6.
- Namespaces
- One XML document can refer to elements
from more than one DTD. (Such documents can no longer be validated
using DTDs, though other schema languages such as RELAX NG can
handle namespaces.) For example, a document might contain both some
text and a diagram. The text might be represented using some
elements from the HTML DTD, and the diagram might use elements from
the Scalable Vector Graphics DTD. All the relevant modules in the
PyXML module can be used for namespace-aware processing.
- XPath and XPointer
- XPath is a language for referring to parts of an XML document. With
XPath you can refer to paragraph number N, or ``all paragraphs of
class "warning"'', or all chapters that have one or more
subsections.
XPointer defines a way to use XPath declarations as the fragment
identifier in a URL to point at a part of an XML document.
See section 7.
- XSLT
- XSLT is a general tool for transforming one XML document
into another document, specifying the transformation using
another XML document called a stylesheet.
- RDF
- The Resource Description Format is for describing metadata about
other resources. The PyXML package doesn't contain any support
for RDF, but a Python library called Redfoot
(http://redfoot.sf.net) is available.