W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: DOM Event Model

From: Arkin <arkin@trendline.co.il>
Date: Wed, 10 Mar 1999 10:28:03 -0500
Message-ID: <36E68F83.CD156205@trendline.co.il>
To: "Lippmann, Jens" <LippmannJ@MICROMODELING.COM>
CC: "'www-dom@w3.org'" <www-dom@w3.org>
I am now working on a design that is supposed to solve this and other
problems. Part of the design are event listeners on nodes which can let
the application know when a change occurs to a node, for example, by
adding a new node underneath. Thus, if your application is interested in
changes to the <foo> element, it can register a listener that will be
notified whenever <foo> elements in the document are change.

At the node level, a node tells its listener whenever an attribute is
changed, the node is moved around the document (context change), or the
node's direct content is changed. At this level, you can either learn
about changes to the <foo> element, or by subscribing to the parent of
<foo> (say <bar>), learn when a new <foo> element is added to the
parent.

At the document level, the document can register a listener that will
automatically associate a listener with new elements. Whenever <bar> is
created, a listener is associated with it, and whenever a <foo> is
created and placed under <bar>, the listener will be notified.

At the factory level, documents of specific types can be associated with
a default listener. Thus, whenever the parser creates a new document of
that type, it will have the listener bound to it. Changes to the
document structure will invoke the listener, without requiring any
change of code in the parser.

Does that make sense?

Arkin


"Lippmann, Jens" wrote:
> 
> Hi,
> 
> I talked to Lauren at the XTech about the DOM event model (and I will read
> the Working Draft before I ask more questions about it) However, there seems
> to be no support for a publish-subscribe event notification planed.
> 
> The following scenario describes what I mean:
> 
> I have system of 2 components exchanging messages. The messages are XML
> documents. A lot of times special processing in the receiver component
> depends on the content and it would be very elegant to have a parser, which
> has an interface to subscribe to a particular content (say the appearance of
> an element name) with a notification callback function. (if tree contains
> <foo> call FooHandle())
> 
> Certainly I could write my own little parser output handler, but it would be
> convenient to have such functionality supported natively by the parser (APIs
> are all about convenience after all)
> 
> Thanks for consideration
> 
> Jens
Received on Wednesday, 10 March 1999 10:34:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT