O'Reilly logo

XML Processing with Python by Sean McGrath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required