[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Inversion of control (was: DOM's javascript roots (was Re:
--- Gavin Thomas Nicol <gtn@r...> wrote: > > On Apr 25, 2006, at 5:34 PM, Tatu Saloranta wrote: > > > But for other use cases -- for example, > > recursive-descent traversal -- event mode is > > ass-backwards. > > When do you really need to do that? I have an > extension of > DefaultHandler that manages a stack of seen elements > so I can track > nesting (calls like getPath() etc). For 99% of the > stuff I do, that > is enough. Yes, but only if you actually enjoy having to implement your stack handlers, dispatchers etc. Pull-parsing removes requirement for such glue code; keeping track of context can be done by normal method calls, hence recursive-descent (but without a need for an in-memory tree model like DOM). It would certainly be possible to do something more evolved on SAX foundation, yacc-style higher-level parser generation. Perhaps pipelined operations are one use case where it would make sense. > That depends on your purpose. If you're building a > DOM tree, I'd > agree. If you're just ripping data out of an XML and > stuffing it into > POJOs, I'd disagree. Even simple path-driver data > extraction (prices > form orders etc.) can be handled easily using SAX > without the > overhead of instantiating DOM trees for XPath Sure. I am not using an in-memory model, just switching the driver of parsing from listening to events, to iterating over similar events. Thing can be done using SAX; just as one's swiss pocket knife can be used for screwing. Just not as well as the real screwdriver. > engines to operate on. > Recursive-descent is a waste of time for > data-binding too IMHO. Building the tree is, agreed. I am not arguing for having to build redundant models, but for using more natural control pattern (iterating over structure vs. listening to events resulting from someone iterating over the said structure). -+ Tatu +- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|