10.5. The DocumentHandler Interface

DocumentHandler is the main interface in SAX from a SAX application development perspective. It establishes handlers for start-tags, end-tags, processing instructions, character data, and so on. There are eight methods in the interface. The full stub interface looks like this.

 CD-ROM reference=10005.txt class DocumentHandler: def characters(self, ch, start, length): "Handle a character data event." pass def endDocument(self): "Handle an event for the end of a document." pass def endElement(self, name): "Handle an event for the end of an element." pass def ignorableWhitespace(self, ch, start, length): "Handle an event for ignorable whitespace in element content." pass def processingInstruction(self, target, ...

Get XML Processing with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.