Module saxdom
source code
This module contains support for a DOM tree representation from an XML
document using a SAX parser.
This functionality exists because we need a DOM interface to generate
the binding classses, but the Python xml.dom.minidom
package
does not support location information. The SAX interface does, so we
have a SAX content handler which converts the SAX events into a DOM
tree.
This is not a general-purpose DOM capability; only a small subset of
the DOM interface is supported, and only for storing the XML information,
not for converting it back into document format.
|
_DOMSAXHandler
SAX handler class that transforms events into a DOM tree.
|
|
Node
Base for the minimal DOM interface required by PyXB.
|
|
Document
Add the documentElement interface.
|
|
Attr
Add the nodeName and nodeValue interface.
|
|
NamedNodeMap
Implement that portion of NamedNodeMap required to satisfy PyXB's
needs.
|
|
Element
|
|
_CharacterData
Abstract base for anything holding text data.
|
|
Text
|
|
Comment
|
|
_DumpDOM(n,
depth=0)
Utility function to print a DOM tree. |
source code
|
|
xml.dom.Document
|
parse(stream,
**kw)
Parse a stream containing an XML document and return the DOM tree
representing its contents. |
source code
|
|
|
parseString(text,
**kw)
Parse a string holding an XML document and return the corresponding
DOM tree. |
source code
|
|
|
xml_file = sys.argv [1]
|
|
doc = parse(file(xml_file))
|
|
__package__ = ' pyxb.utils '
|
Parse a stream containing an XML document and return the DOM tree
representing its contents.
Keywords not described here are passed to saxutils.make_parser.
- Parameters:
stream - An object presenting the standard file read
interface from which the document can be read.
content_handler_constructor - Input is overridden to assign this a value of _DOMSAXHandler.
- Returns:
xml.dom.Document
|