Thanks all
My point may have not be that clear> I had a vague knowledge about sax event and dom tree in memory. Then why I like Smalltalk is that with some comments and a bunch of examples I do not need a doc: I always remember the quote of Dan about the fact that one single person could learn it and this is the learning part that is important for me. I do not like comments or examples for the sake of them, I do because I want to let other learning.
So each time I learn something new I try yo write it as tests or as comments and yesterday my network connection was down so not browsing of internet resources the night.....only squeak classes without examples and comments.
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:
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 -