YAXO and XML question

Bert Freudenberg bert at impara.de
Thu Feb 3 00:08:49 UTC 2005


Am 02.02.2005 um 18:35 schrieb David Shaffer:

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

For quick results I just use the XMLDOMParser. Open an explorer on this:

	XMLDOMParser addressBookXMLWithDTD

Then you can traverse the resulting XMLDocument tree and extract 
whatever you need.

- Bert -




More information about the Squeak-dev mailing list