Package pyxb :: Package utils :: Module saxdom |
[hide private]
[frames] | no frames]

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

Classes | [hide private]
_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

Functions | [hide private]
_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(xml_text, **kw) Parse a string holding an XML document and return the corresponding DOM tree. | source code

Variables | [hide private]
| _log = `logging.getLogger(__name__)`
| xml_file = `sys.argv [1]`
| doc = `parse(open(xml_file))`
| __package__ = ``'``pyxb.utils``'``

Function Details | [hide private]

### parse(stream, **kw) | source code
Parse a stream containing an XML document and return the DOM tree representing its contents. Keywords not described here are passed to pyxb.utils.saxutils.make_parser. Parameters: `stream` - An object presenting the standard file `read` interface from which the document can be read. The content should be data, not text. `content_handler_constructor` - Input is overridden to assign this a value of _DOMSAXHandler. Returns: `xml.dom.Document`

### parseString(xml_text, **kw) | source code
Parse a string holding an XML document and return the corresponding DOM tree. Parameters: `xml_text` - the XML content to be parsed, in a text representation.