[jdom-interest] Re: Proposal: JDOM event based processing
Joseph Bowbeer
jozart at csi.com
Mon Nov 6 16:44:12 PST 2000
The proposal, as I understand it, it so implement an event stream at a
higher level than SAX.
These events would be at the sub-document level rather than at the
sub-element (SAX) level. This way, you can register interest in
sub-trees matching a certain XPath and you'll receive notification as
they are encountered.
The advantage to this would be that you can process a very long event
stream in real time, rather than having to wait for the whole document
to be built.
One application: event log processing.
Suppose you're processing an event log of the form:
<log>
<entry time="nn:nn:nn" message="something"/>
...
</log
In practice, the log is effectively infinite in length.
The only way to process this kind of thing now is using SAX.
The proposal would give users a way to receive Entry elements (in JDOM)
as they are added to the log.
--
Joe Bowbeer
----- original message -----
Patrick Dowler Patrick.Dowler at nrc.ca
Mon, 6 Nov 2000 15:40:53 -0800
Umm, isn't the whole point of JDOM to have an object model rather than
an event stream? If you want events, wouldn't you use SAX directly?
The thing described below could be implemented as an event handler
(using SAX) or as a tree-walker (using JDOM). You SAXProcessor coudl
just as
easily be a JDOMWalker, yes?
Document doc = ...
JDOMWalker walker = new JDOMWalker();
walker.addProcessor( "book", new BookHandler() );
walker.walk( doc );
More information about the jdom-interest
mailing list