XML Standards Update; Introducing XML Events

The HTML Working Group of W3C released a Last Call Working Draft of XML Events on October 26, 2001.  XML Events defines a module used to associate behaviors with document-level markup for XML languages, and supports the DOM Level 2 event model. 

The following definitions are useful in understanding XML Events: 

  • An XML event is the representation of some asynchronous occurrence that gets associated with an element in an XML document.  An example of an event would be  a mouse click on the presentation of the element.
  • An action is some way of responding to an event; 
  • A handler is some specification for such an action such as scripting or some other method. 
  • A listener is a binding of such a handler to an event targeting some element in a document.
  • General behavior is that when an event occurs it is dispatched by passing it down the document tree to the element
  • Capture Phase is the phase where the event is dispatched down the document tree
  • Target is the element to which an event is targeted
  • Observer is any element in the path of the XML event in the document tree
  • Bubbling Phase is the phase when a response is passed from the target back to the root

In the DOM Level 2 model of events, the general behavior is that when an event occurs it is dispatched by passing it down the document tree from the root in a phase called capture to the element where the event occurred (called its target), where it then may be passed back up the tree again in the phase called bubbling. In general, an event can be responded to at any element in the path (an observer) in either phase by causing an action, and/or by stopping the event, and/or by cancelling the default action for the event at the place it is responded to.

HTML currently binds events to an element by encoding the event name in an attribute name, such that the value of the attribute is the action for that event at that element. An example is "onmouseover."  This method hardwires the events into the language.  This is a disadvantage because in order to add a new event, a change to the language must be made.  This binding also forces you to mix the content of the document with the specifications of the scripting and event handling, rather than allowing for a separation.  XML Events provides an extensible event specification method that provides for new event types without requiring modification to the DOM or the DTD and allows for integration with other XML languages.

Return to TOC