XML Events

XML Events is a W3C specification to handle events that occur in an XML document. These events are typically triggered by a user who interacts with the document, a web page using a web browser on a PC, mobile phone or telephone.

Formal definition

Technically, an XML event representation of an asynchronous operation (eg, a mouse click on a button ) which any data element is assigned in an XML document. XML event provides a static bond to the syntactic DOM events interface, whereby the event can be processed.

Motives

The XML Events standard has been defined to provide XML - based languages ​​a way to integrate single observer and associated event handlers in Document Object Model (DOM ) Level 2 event interfaces. The result is an intuitive, interoperable method to associate behavior with XML-based documents, such as XHTML.

Benefits of XML Events

XML Events utilizes a separation of concerns design template, and its technology is very neutral thanks to handler. Thus, the website designers freedom is given in terms of code organization and separation of document content and script is also possible.

Both earlier HTML and earlier versions of SVG elements combine with a presentation element, the fact that the event name is encoded in an attribute name. Thus, the value of the attribute is the same action for the event of the element. For example (using the onclick attribute ):

Stay here This design has three disadvantages:

Relationship to other standards

Unlike events in the DOM, which are connected as specified fixed to the respective HTML document, XML events were designed to be completely independent of the representational or processing device. XML Events are extensively used in XForms, and in version 1.2 of the SVG specification.

Example of XML events using of listeners in XForms

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

< html     xmlns = " http://www.w3.org/2002/xhtml "     xmlns: ev = " http://www.w3.org/2001/xml-events "     xmlns: xf = " http://www.w3.org/2002/xforms " >            ...        < ev: listener event = " DOMActivate " observer = " myButton "            handler = "# doit " />         ... In this example, the handler will doit (for example a javascript script element ) executed when the DOMActivate event occurs when the data element with the ID attribute of my button.

831510
de