[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:

  • To: XML Developers List <xml-dev@l...>
  • Subject: Re: Inversion of control (was: DOM's javascript roots (was Re: Have JDOM / XOM / etc. failed?))
  • From: Tatu Saloranta <cowtowncoder@y...>
  • 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@r...>

javascript dom recursion
--- 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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.