10.8. A SAX Inspection Application

In this section, we develop a useful application that converts a sequence of SAX events into an XML document. This application is a useful debugging tool because it allows you to see at a glance the precise sequence of events generated by any SAX-compliant parser.

Given an XML document like this

CD-ROM reference=10024.txt
<Greeting x = "y">Hello World</Greeting>

the application generates this:

CD-ROM reference=10025.txt
<?xml version="1.0"?>
<Element name="Greeting">
<Attribute name = "x" type = "CDATA" value="y"/>
<chars>Hello World</chars>

We will start with the DTD for the event sequence.

 CD-ROM reference=10026.txt ...

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.