Creating a Graphical Browser

In the previous chapter, I adapted the DOM parser browser that we wrote to display circles. It will be instructive to do the same here for the SAX parser browser because it will show how to retrieve specific attribute values. Here's the document that this browser might read—in this chapter, I'll call this document ch12_06.xml. As in the previous chapter, I'm specifying the (x, y) origin of each circle and the radius of the circle as attributes of the <CIRCLE> element:

Listing . ch12_06.xml
 <?xml version = "1.0" ?> <!DOCTYPE DOCUMENT [ lt;!ELEMENT DOCUMENT (CIRCLE|ELLIPSE)*> <!ELEMENT CIRCLE EMPTY> <!ELEMENT ELLIPSE EMPTY> <!ATTLIST CIRCLE X CDATA #IMPLIED Y CDATA #IMPLIED RADIUS CDATA #IMPLIED> <!ATTLIST ELLIPSE ...

Get Real World XML now with O’Reilly online learning.

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