YAXO and XML question

David Shaffer cdshaffer at acm.org
Wed Feb 2 17:35:19 UTC 2005


stéphane ducasse wrote:

> Hi
>
> I'm trying to understand how to use Yaxo and I cannot figure out
> what is the difference between the SAXDriver and SAXHandler.
> Of course there is no comment, no reference to the class SAXHandler....
> Does anybody has an example?
>
> Stef
>
> PS: this is not a fatality, this is a state of mind!
>
>
Stef,

SAX is an event drive API for processing XML documents.  While 
java-based it is relatively standard across languages.  There are 
several Java resources but here's one which helped me:

http://www.saxproject.org/

Most implementations of SAX (including the one included with the "full" 
3.7 image) are mostly "2.0" compliant which seems to me including XML 
namespaces (someone correct me if I'm wrong here) so the sample code on 
these pages which specifically deals with namespaces also transfers well 
to Smalltalk.  As for Smalltalk examples, well, look at the subclasses 
of SAXHandler...one of these uses SAX to build the somewhat standard DOM 
tree.  So, one has two choices when dealing with XML: event drive with 
SAX (usually, but not always, building the tree yourself) or DOM where 
the XML tree gets build from generic components (XMLElements).

Sorry if this is not specific enough...I'm sure others will chime in 
with concrete examples but I think knowing SAX, per se, is as important 
as knowing the Smalltalk implementation since it ensures that the two 
don't get too far apart.

David




More information about the Squeak-dev mailing list