[jdom-interest] streamdom -- middle ground between SAX and DO M
bob mcwhirter
bob at werken.com
Wed Jan 2 07:10:41 PST 2002
> Good point -- there are similarities. Both ElementHandler and
> streamdom are attempts to add event handling to DOM processing
> but there are two problems with the ElementHandler api
> that streamdom resolves:
>
> (1) The ElementHandler API is a side-effect
> to the building of the DOM tree, so the entire document is
> still being built in memory. With streamdom, you can
> ignore elements, so you can ask the parser not to build
> the root element.
dom4j just needs a way to bind a default ElementHandler, who's
purpose is simply to detach() the subtree.
> (2) The ElementHandler API is SAX-like -- you get
> onStart and onEnd notifications. streamdom provides
> the **entire** element, with attributes and child nodes
> to the programmer, so the processing is DOM-like.
The onStart is nice for set-up stuff, since you have the element name
and attributes, an onEnd is effectively the same as streamdom's, since
you can get the entire sub-tree at that call, do XPaths, etc.
-bob
More information about the jdom-interest
mailing list