OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Inversion of control (was: DOM's javascript roots (was Re:

[ Lists Home | Date Index | Thread Index ]
  • To: XML Developers List <xml-dev@lists.xml.org>
  • Subject: Re: [xml-dev] Inversion of control (was: DOM's javascript roots (was Re: [xml-dev] Have JDOM / XOM / etc. failed?))
  • From: Tatu Saloranta <cowtowncoder@yahoo.com>
  • Date: Wed, 26 Apr 2006 15:01:59 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=yD8DkRCGyCu1kuq8URvuLFlKEHSBxIbNnRbQO9Js61P2XXUAdKIIpU6WCNwwnOAe4InhpLdQFFk9TqygIr7hEN8xcvPTBOa0V4Ywcc/ueyTZJ8fIjgDinIw6zIhL+hiJEvOhHgSVpKUaWCGY2WNKIVoyGSYKxYGhHSPnFvMrQ00= ;
  • In-reply-to: <E2D9D93A-36BE-43D5-AC51-CD96F6739F4D@rbii.com>

--- Gavin Thomas Nicol <gtn@rbii.com> 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 




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS