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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.