Jimmy Zhang wrote:
> I have some questions on the meanfulness of performance metrics of
> all the SAX or Pull based parsers. In my view, all stream based
> parsers doesn't take into the account that the user-implemented data
> extraction logic that imbedded into the call-back functions (SAX) may
> be far more costly than the raw parsing itself. Here is my analogy of
> someone walk into a japanese restaurant:
hi,
that is right and nobody expects DOM to be faster but still it is
important to know what is overhead of creating of all XML in memory
(DOM) when compared to streaming parsing (SAX).
> Using DOM parsers is like order Sashimi (fish meat) that has all
> bones removed, so although one waits a little
> longer for the fish meat, once he gets it, he will be able to eat very
> fast.
>
> Using SAX is like getting the whole fish, one has to cut the fish open
> and get rid of all the organs and bones. Even
> he gets the fish very very quickly, it is going to take him a while
> before he can eat anything.
>
> My point is that all metrics on raw SAX or Pull parser is deceiving.
>
> I am looking forward to your comments.
>
interesting analogy - based on this analogy i would say: DOM parser
gives you raw meat and you have to cook it yourself (or eat it raw if
you like it but not all food is good for it) however SAX and XmlPull
gives you preparation/conversion/cooking tools (XML events that are
transient) and you only have to deal with raw product shortly just
enough to produce what you really like to have (including DOM as most
DOM implementations uses SAX to construct DOM tree ...).
extending this analogy: in XPP2 i have XmlPullNode that allows both to
do DOM-like navigation but also to skip parts of XML tree or to presents
them as XmlPullParser (or SAX2) events so you can have both approaches
and apply them both to different parts of the same XML document if
needed :-)
thanks,
alek
--
"Mr. Pauli, we in the audience are all agreed that your theory is crazy.
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr