- Source: XML Events
In computer science and web development, XML Events is a W3C standard 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
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.
Motivation
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 separation of concerns design pattern, and is technology-neutral with regard to handlers. It gives authors freedom in organizing their code and allows separation of document content from 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:
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
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:
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
ECMAScript
JavaScript
DOM Events
XForms
XHTML
References
External links
W3C XML Events Specification was a W3C Recommendation on 14 October 2003
W3C XML Events for HTML Authors tutorial
Kata Kunci Pencarian:
- Konsorsium World Wide Web
- XMLHttpRequest
- Daftar ilmuwan komputer
- Saptalomba
- Upcoming
- Komunikasi antar proses
- Lari 400 meter
- IPhoto
- React.js
- Stepan Bandera
- XML Events
- Streaming Transformations for XML
- Simple API for XML
- XML
- HaXml
- XML Script
- XML pipeline
- Document Object Model
- XHTML
- Java API for XML Processing