Package pyxb :: Package binding :: Module saxer :: Class PyXBSAXHandler |
[hide private]
[frames] | no frames]

# type PyXBSAXHandler

source code

    xml.sax.handler.ContentHandler --+
                                     |
                            object --+
                                     |
         utils.saxutils.BaseSAXHandler --+
                                         |
                                        PyXBSAXHandler

A SAX handler class which generates a binding instance for a document through a streaming parser.

An example of using this to parse the document held in the (unicode) text value `xmlt` is:

     import pyxb.binding.saxer
     import io

     saxer = pyxb.binding.saxer.make_parser()
     handler = saxer.getContentHandler()
     saxer.parse(io.StringIO(xmlt))
     instance = handler.rootObject()

Instance Methods | [hide private]
rootObject(self) Return the binding object corresponding to the top-most element in the document | source code
reset(self) Reset the state of the handler in preparation for processing a new document. | source code
__init__(self, **kw) Create a parser instance for converting XML to bindings. | source code
startElementNS(self, name, qname, attrs) Process the start of an element. | source code
endElementNS(self, name, qname) Process the completion of an element. | source code
Inherited from `utils.saxutils.BaseSAXHandler`: `characters`, `elementState`, `fallbackNamespace`, `ignorableWhitespace`, `location`, `namespaceContext`, `processingInstruction`, `setDocumentLocator`, `startDocument`, `startPrefixMapping` Inherited from `xml.sax.handler.ContentHandler`: `endDocument`, `endElement`, `endPrefixMapping`, `skippedEntity`, `startElement`

Class Variables | [hide private]
| __trace = `False`
| __XSITypeTuple = ``(``'``http://www.w3.org/2001/XMLSchema-instance``'``,``...``
| __domHandler = `None`
| __domDepth = `None`
| __rootObject = `None`

Method Details | [hide private]

### rootObject(self) | source code
Return the binding object corresponding to the top-most element in the document Returns: An instance of basis._TypeBinding_mixin (most usually a basis.complexTypeDefinition. Raises: `pyxb.[UnrecognizedDOMRootNodeError` - No binding could be found to match the top-level element in the document. Overrides: utils.saxutils.BaseSAXHandler.rootObject

### reset(self) | source code
Reset the state of the handler in preparation for processing a new document. Returns: `self` Overrides: utils.saxutils.BaseSAXHandler.reset

### __init__(self, **kw) (Constructor) | source code
Create a parser instance for converting XML to bindings. Parameters: `element_state_constructor` - Overridden with the value _SAXElementState before invoking the superclass constructor. Overrides: xml.sax.handler.ContentHandler.__init__

### startElementNS(self, name, qname, attrs) | source code
Process the start of an element. Overrides: xml.sax.handler.ContentHandler.startElementNS (inherited documentation)

### endElementNS(self, name, qname) | source code
Process the completion of an element. Overrides: xml.sax.handler.ContentHandler.endElementNS (inherited documentation)

Class Variable Details | [hide private]

  ### __XSITypeTuple Value:
      ('http://www.w3.org/2001/XMLSchema-instance', 'type')