World Library  
Flag as Inappropriate
Email this Article

XML Events

Article Id: WHEBN0006156945
Reproduction Date:

Title: XML Events  
Author: World Heritage Encyclopedia
Language: English
Subject: World Wide Web Consortium, XML, XHTML, Multimodal interaction, Internationalization Tag Set
Collection: World Wide Web Consortium Standards, Xml
Publisher: World Heritage Encyclopedia

XML Events

In computer science and web development, XML Events is a W3C standard[1] for handling events that occur in an XML document. These events are typically caused by users interacting with the web page using a device, such as a web browser on a personal computer or mobile phone.


  • Formal definition 1
  • Motivation 2
  • Advantages of XML Events 3
  • Relationship to other standards 4
  • Example of XML Events using a listener in XForms 5
  • See also 6
  • References 7
  • External links 8

Formal definition

An XML Event is the representation of some asynchronous occurrence (such as a mouse button click) that gets associated with a data element in an XML document. XML Events provides a static, syntactic binding to the DOM Events interface, allowing the event to be handled.


The XML Events standard is defined to provide XML-based languages with the ability to uniformly integrate event listeners and associated event handlers with Document Object Model (DOM) Level 2 event interfaces. The result is to provide a declarative, interoperable way of associating behaviors with XML-based documents such as XHTML.

Advantages of XML Events

XML Events uses a scripting.

Legacy HTML and early SVG versions bind events to presentation elements 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. For example (with Javascript’s onclick attribute):

Stay here!

This design has three drawbacks:

  1. it hard-wires the events into the language, so that adding new event types requires changes to the language
  2. 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.
  3. it restricts authors to a single scripting language per document.

Relationship to other standards

Unlike DOM Events, which are usually associated with HTML documents, XML events are designed to be independent of specific devices. XML Events are used extensively in XForms and in version 1.2 of the SVG specification, as of July 2006, which is still a working draft.

Example of XML Events using a listener in XForms

The following is an example of how XML events are used in the XForms specification:

Do it!

In this example, when the DOMActivate event occurs on the data element with an id attribute of myButton, the handler doit (for example, a JavaScript element) is executed.

See also


  1. ^

External links

  • W3C XML Events Specification was a W3C Recommendation on 14 October 2003
  • W3C XML Events for HTML Authors tutorial
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.