Package dataprocessor :: Package sax :: Module saxwrapper :: Class SaxWrapper
[hide private]
[frames] | no frames]

Class SaxWrapper

source code

xml.sax.handler.ContentHandler --+
                                 |
                                SaxWrapper

Abstract SAX wrapper to facilitate use of older minidom processors.

Instance Methods [hide private]
 
__init__(self, element_focus, reader=<class dataprocessor.input.genericreader.GenericReader at 0xa0..., writer=<class 'dataprocessor.output.xmlwriter.GenericWriter'>, filename_out='') source code
 
startElement(self, name, attrs=[])
Signals the start of an element (simplesentence or parallelsentence)
source code
 
characters(self, ch)
The Parser will call this method to report each chunk of character data.
source code
 
endElement(self, name)
Signals the end of an element.
source code
 
endDocument(self)
Receive notification of the end of a document.
source code

Inherited from xml.sax.handler.ContentHandler: endElementNS, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElementNS, startPrefixMapping

Class Variables [hide private]
  i = 0
Method Details [hide private]

__init__(self, element_focus, reader=<class dataprocessor.input.genericreader.GenericReader at 0xa0..., writer=<class 'dataprocessor.output.xmlwriter.GenericWriter'>, filename_out='')
(Constructor)

source code 
Overrides: xml.sax.handler.ContentHandler.__init__

startElement(self, name, attrs=[])

source code 

Signals the start of an element (simplesentence or parallelsentence)

Parameters:
  • name (str) - the name of the element
  • attrs (Attributes) - of the element type as a string and the attrs parameter holds an object of the Attributes interface containing the attributes of the element.
Overrides: xml.sax.handler.ContentHandler.startElement

characters(self, ch)

source code 

The Parser will call this method to report each chunk of character data. We use it to store the string

Parameters:
  • ch (str) - character being parsed
Overrides: xml.sax.handler.ContentHandler.characters

endElement(self, name)

source code 

Signals the end of an element. Data stored in global vars of the class, time to create our objects and fire their processing

Parameters:
  • name (str) - the name of the element
  • attrs (Attributes) - of the element type as a string and the attrs parameter holds an object of the Attributes interface containing the attributes of the element.
Overrides: xml.sax.handler.ContentHandler.endElement

endDocument(self)

source code 

Receive notification of the end of a document.

The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.

Overrides: xml.sax.handler.ContentHandler.endDocument
(inherited documentation)