[squeak-dev] SAX? or SAX2? THAT! is the Question!!

gettimothy gettimothy at zoho.com
Fri Oct 1 17:29:52 UTC 2021


Hi folks.



Asking for advice.


I am now diving into learning and documenting Monty's SAX stuff.



I have never coded a SAX (I played Tuba in band, though)



Should I focus on SAX or SAX2?



The XML-Parser SaxHandler has a massive class comment that I could start with...



However, it has a subclass SAX2Parser with an interesting comment:



This class is a parser with an API like SAX 2.0, with separate SAX2ContentHandler, SAX2LexicalHandler, and SAX2DeclarationHandler classes that are subclassed unlike SAX 1.0 where a single,  unified handler class is subclassed directly. Parsers can be created with #on: or other instance creation messages, and instances of the content, lexical, and declaration handlers can be injected before parsing with #contentHandler:, #lexicalHandler:, and #declarationHandler:, like this:

(SAX2Parser on: xmlStringOrStream)

contentHandler: MyContentHandlerClass new;

declarationHandler: MyDeclarationHandlerClass new;

lexicalHandler: MyLexicalHandlerClass new;

parseDocument.



Each handler can access the SAX2Parser object with #parser and set the parsing result returned by #parseDocument with #parsingResult:.



SAXHandler is not deprecated and can still be used if you prefer the SAX 1.0 style API.





I am thinking I should start with SAX2 study.



Do? Don't? Run Away?



thanks for your time.



t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211001/c3998a6b/attachment.html>


More information about the Squeak-dev mailing list