Okey,
The Elements telling the Document that something has changed seems like a good approach,
I´ve been thinking about using the ElementHandler at parsetime to look for the XHTML Event elements like "onevent" and based on that instantiate an appropriate listener and add it to some kind of listener stack. When the complete tree is in memory maybe there is a way to attach them to the appropriate element. If the document is the responsible party it may be simpler than that. An element could tell the document about a change in it´s status according to some kind of eventinterface and the Document could fire the appropriate eventlistener.
Could there be a problem with several events firing and telling the Document that something has changed? I mean performance wise?
I guess it could be modeled on the W3C DOM2 Events but it should definitely be optional to have the events turned on or off.
Is it possible at parse time to build the tree structure with or without events turned on. Two different implementations of the Node, one which implements some kind of eventhandling?
 
What are your ideas so far?
 
/Regards Mats
 
----- Original Message -----
Sent: Tuesday, June 26, 2001 4:53 PM
Subject: Re: [dom4j-dev] DOM2 Events in DOM4J

Hi Mats
I´ve studied the Javadocs and I was wondering what kind of support (or similiar) for the DOM2 Events the API has?
Is it possible to use event listeners on TargetNodes in the DOM4J so that for instance a change in an elements character data triggers an event which is handled by an eventlistener?
Or is there a similiar approach for eventbased handling?
Right now the event based notification is primarily used at parsing time to notify you as parts of a document gets constructed. This allows massive XML documents to be processed efficently in a kind of row by row manner, only keeping one row in memory at once.
 
We don't yet offer any event based APIs for editing XML....
What I´m trying to achieve is the XForms instance data as a DOM, this DOM is updated according to events which in turn can trigger other events.
Is this possible with the current design of the API. I would really like to use it since it some really nice features, ie, the XPath support, Ruleengine..
This is one is currently on the drawing board. We want to be able to work nicely with XForms for building web apps too.
 
I'd like the support of listeners to be optional, so that parsing and modifying XML structures doesn't take the performance hit of having Lists of listeners all over the place.
 
So I'd like some kind of mechansim which has no cost if you don't use it but is pretty fast if you do. So I'm thinking that the Document could be the thing that you listen to for events that occur in the tree and the Elements notify the parent Document on changes.
 
So something analagous to DOM2's 'Events' will probably be added to dom4j really soon (by all means dive in if you want to help do it ;-)
 
James
 

Reply via email to