Package pyxb :: Package utils :: Module saxutils :: Class BaseSAXHandler |
[hide private]
[frames] | no frames]

# type BaseSAXHandler

source code

    xml.sax.handler.ContentHandler --+
                                     |
                            object --+
                                     |
                                    BaseSAXHandler

Known Subclasses:
  - binding.saxer.PyXBSAXHandler
  - , saxdom._DOMSAXHandler

A SAX handler class that maintains a stack of enclosing elements and manages namespace declarations.

This is the base for pyxb.utils.saxdom._DOMSAXHandler and pyxb.binding.saxer.PyXBSAXHandler.

Instance Methods | [hide private]
location(self) Return the current location within the SAX-processed document. | source code
fallbackNamespace(self) Return the namespace used to resolve unqualified names with no default namespace. | source code
namespaceContext(self) Return the namespace context used for QName resolution within the current element. | source code
elementState(self) | source code
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 new `xml.sax.handler.ContentHandler` instance to maintain state relevant to elements. | source code
setDocumentLocator(self, locator) Save the locator object. | source code
startDocument(self) Process the start of a document. | source code
__getOrCreateNextNamespaceContext(self) | source code
startPrefixMapping(self, prefix, uri) Implement base class method. | 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
__flushPendingText(self) | source code
characters(self, content) Save the text as content | source code
ignorableWhitespace(self, whitespace) Save whitespace as content too. | source code
processingInstruction(self, target, data) Receive notification of a processing instruction. | source code
Inherited from `xml.sax.handler.ContentHandler`: `endDocument`, `endElement`, `endPrefixMapping`, `skippedEntity`, `startElement`

Class Variables | [hide private]
| __locationTemplate = `None`
| __elementStateConstructor = `None`
| __fallbackNamespace = `None`
| __nextNamespaceContext = `None`
| __namespaceContext = `None`
| __includingContext = `None`
| __locator = `None`
| __elementState = `None`
| __elementStateStack = ``[``]``
| __rootObject = `None`
| __pendingText = `None`
| __pendingTextLocation = `None`

Method Details | [hide private]

### namespaceContext(self) | source code
Return the namespace context used for QName resolution within the current element. Returns: An instance of pyxb.namespace.resolution.NamespaceContext

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

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

### __init__(self, **kw) (Constructor) | source code
Create a new `xml.sax.handler.ContentHandler` instance to maintain state relevant to elements. Parameters: `fallback_namespace` - Optional namespace to use for unqualified names with no default namespace in scope. Has no effect unless it is an absent namespace. `element_state_constructor` - Optional callable object that creates instances of SAXElementState that hold element-specific information. Defaults to SAXElementState. `target_namespace` - Optional namespace to set as the target namespace. If not provided, there is no target namespace (not even an absent one). This is the appropriate situation when processing plain XML documents. `location_base` - An object to be recorded as the base of all pyxb.utils.utility.Location instances associated with events and objects handled by the parser. Overrides: xml.sax.handler.ContentHandler.__init__

### setDocumentLocator(self, locator) | source code
Save the locator object. Overrides: xml.sax.handler.ContentHandler.setDocumentLocator

### startDocument(self) | source code
Process the start of a document. This resets this handler for a new document. Overrides: xml.sax.handler.ContentHandler.startDocument Note: setDocumentLocator is invoked before startDocument

### startPrefixMapping(self, prefix, uri) | source code
Implement base class method. Overrides: xml.sax.handler.ContentHandler.startPrefixMapping Note: For this to be invoked, the `feature_namespaces` feature must be enabled in the SAX parser.

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

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

### characters(self, content) | source code
Save the text as content Overrides: xml.sax.handler.ContentHandler.characters

### ignorableWhitespace(self, whitespace) | source code
Save whitespace as content too. Overrides: xml.sax.handler.ContentHandler.ignorableWhitespace

### processingInstruction(self, target, data) | source code
Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method. Overrides: xml.sax.handler.ContentHandler.processingInstruction (inherited documentation)