|
Boost : |
From: Alan Gutierrez (alan-boost_at_[hidden])
Date: 2005-11-05 23:30:31
* Jez Higgins <jez_at_[hidden]> [2005-11-04 07:31]:
> Jose wrote:
> > On 11/4/05, Jez Higgins <jez_at_[hidden]> wrote:
> >> In other cases, and I accept that I might be unusual in this, SAX
> >> is the right thing to use.
> >
> > For large XML files, an event or libxml2 reader api is the only option
> > Which other cases do refer to ?
>
> I was referring to an event API over a reader API. Filtering, for
> example, adding or removing something from a document, is
> straightforward with SAX.
> I was being slightly sarcastic. There are a number of people who find
> SAX, or SAX-like, interfaces difficult to use, and advocate "better"
> alternatives. I'm not one of them.
Pull and push are two different methods of looking at XML as
events, and they both have their advantages. Pull parsers (XPP
or StAX) are not "better" than SAX.
> Similarly there are a number of people who regard the DOM as impossibly
> complex. There was an earlier poster who more-or-less described the DOM
> in Java as dead. That's not my experience, and it's not my opinion.
I didn't say it was dead. It is part of the JDK, which means it
will zombie on for years to come. I'm only noting that most
folks feel that it is a stove-pipe API, too heavy for many
applications.
If you use the W3C DOM that ships with JDK as is, it implements
the W3C DOM Event API, and thus dispatches events with nodes are
appended to a document. This will hurt you when you build a
large document using appendNode.
An example of how W3C DOM does by supporting many different
concepts, is a poor choice for an application that needs any one
concept. (The browser is the only application I've worked with
that uses them all effecitvely.)
I offer the mulititude of alternatives, XMLBeans, XOM, JDOM,
Dom4J, as evedence that something is amiss. These are people who
dislike W3C DOM such that they will offer a replacement.
There are no real alteratives to SAX. The Simple API to XML is
just that, simple. There is a Xerces parser event API, but
otherwise, I'm not aware of any widely depoyed SAX alternatives.
-- Alan Gutierrez - alan_at_[hidden] - http://engrm.com/blogometer/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk