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.

## Contents

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

## 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 <a href="http://www.example.org" onclick="window.alert('Hello!'); return false;">here</a>! `

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[update], 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:

<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 `doit` (for example, a JavaScript element) is executed.

## See also

* ECMAScript
* JavaScript
* DOM Events
* XForms
* XHTML

## References

1. ↑ "XML Events: An Events Syntax for XML". World Wide Web Consortium. 2003-10-14. http://www.w3.org/TR/xml-events/.

## External links

* W3C XML Events Specification was a W3C Recommendation on 14 October 2003
* W3C XML Events for HTML Authors tutorial

* v
* t
* e

World Wide Web Consortium (W3C)

Products and
standards|

| Recommendations|

* ActivityPub
* ARIA
* Canonical XML
* CDF
* CSS
* DOM
* Geolocation API
* HTML (HTML5)
* ITS
* JSON-LD
* Linked Data Notifications
* MathML
* Micropub
* OWL
* PLS
* RDF
* RDF Schema
* SISR
* SKOS
* SMIL
* SOAP
* SRGS
* SRI
* SSML
* SVG
* SCXML
* SHACL
* SPARQL
* Timed text
* VoiceXML
* Web storage
* WSDL
* Webmention
* WebSub
* XForms
* XHTML
* XHTML+RDFa
* XInclude
* XLink
* XML
* XML Base
* XML Encryption
* XML Events
* XML Information Set
* XML namespace
* XML Schema
* XML Signature
* XOP
* XPath
* XPath 2.0
* XPointer
* XProc
* XQuery
* XSL
* XSL-FO
* XSLT (elements)

|

Notes|

* IndieAuth
* JF2
* Post Type Discovery
* XAdES
* XHTML+SMIL
* XUP

Working drafts|

* CCXML
* CURIE
* EME
* InkML
* MSE
* RIF
* SMIL Timesheets
* sXBL
* XFDL
* XFrames
* XBL
* XMLHttpRequest

Guidelines|

* Web Content Accessibility Guidelines

Initiative|

* Multimodal Interaction Activity (MMI)
* Markup Validation Service
* Web Accessibility Initiative
* WebPlatform

Deprecated|

* C-HTML
* HDML
* JSSS
* PGML
* VML
* XHTML+MathML+SVG

Obsoleted|

* P3P

Organizations|

* Advisory Committee (AC)
* World Wide Web Foundation

Elected groups|

* Advisory Board (AB)

Working groups|

* CSS
* Geolocation
* Social Web
* SVG
* Web Hypertext Application Technology (WHATWG)
* Web Platform

Community groups|

* Web Incubator Community Group (WICG)

Closed groups|

* Device Description (DDWG)
* HTML

Software|

* CERN httpd
* Libwww

Browsers|

* Line Mode (1990–)
* Arena (1993–98)
* Agora (1994–97)
* Argo (1994–97)
* Amaya (browser/editor, 1996–2012)

Conferences|

* International World Wide Web Conference (IW3C)
* Steering Committee (IW3C2)
* First conference ("WWW1", 1994)

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/XML Events. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=XML_Events&oldid=313239"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template