June 2000
Intermediate to advanced
556 pages
8h 45m
English
In chapter 10, we saw how the popular event-driven XML processing style can be used in Python with the Python implementation of the SAX API. Pyxie also provides event-driven XML-processing capabilities. Perhaps the biggest difference is that with Pyxie, event handlers can be named after the element types that they process. This is best illustrated by example. The following program has code to handle start-tags for greeting elements and end-tags for b elements. It also has a handler for data content that prints out the first four characters of the data.
CD-ROM reference=12006.txt
C>type p6.py """ Event-driven XML processing with Pyxie """ from pyxie import * # Create a class derived from xDispatch. class myHandler(xDispatch): ...Read now
Unlock full access