[
Lists Home |
Date Index |
Thread Index
]
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.
> While I have written event dispatchers (just as pretty
> anyone who has had to work on bare SAX API), it is
> monkey work best avoided. Like climbing up the tree
> ass first. Better delegate that monkey work to parser
> implementors.
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 engines to operate on.
Recursive-descent is a waste of time for data-binding too IMHO.
> Why? If I am doing data binding, it is the end of the
> line. Same for parsing configuration settings or
> import/exporting data of different type (object
> graphs, relational data).
If you're doing data binding, the value of DOM is questionable.
> While pipelines are important for transformations
> within xml (infoset), their utility ends where XML
> domains starts/ends.
That's true of DOM as well.
|