This article needs additional citations for verification. (November 2008)
An XML Event is the representation of some
The XML Events standard is defined to provide XML-based languages with the ability to uniformly integrate
Advantages of XML Events
XML Events uses a
Stay <a href="http://www.example.org" onclick="window.alert('Hello!'); return false;">here</a>!
This design has three drawbacks:
- it hard-wires the events into the language, so that adding new event types requires changes to the language
- it forces authors to mix the content of the document with the specifications of the scripting and event handling, rather than allowing them to separate them.
- it restricts authors to a single scripting language per document.
Relationship to other standards
Example of XML Events using a listener in XForms
The following is an example of how XML events are used in the XForms specification:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <ev:listener event="DOMActivate" observer="myButton" handler="#doit"/> </head> <xf:trigger xml:id="myButton"><xf:label>Do it!</xf:label></xf:trigger> <script xml:id="doit" type="application/ecmascript"> alert("test"); </script> </html>
In this example, when the
DOMActivate event occurs on the data element with an id attribute of
myButton, the handler
- "XML Events: An Events Syntax for XML". World Wide Web Consortium. 2003-10-14. Retrieved 2008-11-19.