Diff between 5b2baf5fbdead93c2728c3a90e3fbc32 and 01d6079ad71a7eeaae306da7cee24c37

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" type="text/css" ?>
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.w3.org/StyleSheets/TR/base.css" type="text/css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>XML Events 2</title>
<style type="text/css">
      .dtd-code {  font-family: monospace; background-color: #dfdfdf; white-space: pre; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
      code {
      color: green;
      font-family: monospace;
      font-weight: bold;
      }
      h4 { color: #005A9C; background: white }
      code.greenmono {
      color: green;
      font-family: monospace;
      font-weight: bold;
      }
      .example {
      border: solid green;
      border-width: 2px;
      color: green;
      font-weight: bold;
      margin-right: 5%;
      margin-left: 0;
      }
      .bad  {
      border: solid red;
      border-width: 2px;
      margin-left: 0;
      margin-right: 5%;
      color: rgb(192, 101, 101);
      }
      div.navbar { text-align: center; }
      div.contents {
      background-color: rgb(204,204,255);
      padding: 0.5em;
      border: none;
      margin-right: 5%;
      }
      .tocline { list-style: none; }
      td { text-align: left }
      .ins { background-color: yellow }
      .del { background-color: yellow; text-decoration: line-through }
      ul.acks { list-style: none }
    p.issueTitle {
        font-size: 150% ;
    }
    div.issue {
        background-color: #cfc ;
        border: none ;
        margin-right: 5% ;
    }
/* assertion styles */

.must, .mustnot, .required, .shall, .shallnot, .should, .recommended, .may, .optional {
    font-style:  italic ;
    background-color: #FF8040 ;
}
    
</style>

<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/base.css" />
</head>
<body>
<div class="head"><a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home" /></a> 

<h1><a id="title" name="title">XML Events 2</a></h1>

<h2><a id="subtitle" name="subtitle">An Events Syntax for XML</a></h2>

<h2><a id="w3c-doctype" name="w3c-doctype">W3C Working Draft 16 February 2007</a></h2>
<h2><a id="w3c-doctype" name="w3c-doctype">W3C Editor's Draft 14 November 2007</a></h2>

<dl>
<dt>This version:</dt>

<dd><a href="http://www.w3.org/TR/2007/WD-xml-events-20070216">http://www.w3.org/TR/2007/WD-xml-events-20070216</a></dd>
<dd><a href="http://www.w3.org/MarkUp/2007/ED-xml-events-20071114">http://www.w3.org/MarkUp/2007/ED-xml-events-20071114</a></dd>

<dt>Latest version:</dt>

<dd><a href="http://www.w3.org/TR/xml-events">http://www.w3.org/TR/xml-events</a></dd>

<dt>Previous version:</dt>

<dd><a href="http://www.w3.org/TR/2003/REC-xml-events-20031014">http://www.w3.org/TR/2003/REC-xml-events-20031014</a></dd>

<dt>Diff from previous recommendation:</dt>

<dd><a href="xml-events-diff.html">xml-events-diff.html</a></dd>
<dd><a href="xml-events-rec-diff.html">xml-events-rec-diff.html</a></dd>

<dt>Editors:</dt>

<dd><a href="mailto:shane@aptest.com">Shane McCarron</a>, <a href="http://www.aptest.com">Applied Testing and Technology, <abbr title="Incorporated">Inc.</abbr></a><br />
 <a href="mailto:mark.birbeck@x-port.net">Mark Birbeck</a>, <a href="http://www.x-port.net">x-port.net Ltd.</a></dd>

<dt>Version 1 Editors:</dt>

<dd><a href="mailto:shane@aptest.com">Shane McCarron</a>, <a href="http://www.aptest.com">Applied Testing and Technology, <abbr title="Incorporated">Inc.</abbr></a><br />
 <a href="http://www.cwi.nl/~steven/">Steven Pemberton</a>, <a href="http://www.cwi.nl"><abbr lang="nl" xml:lang="nl" title="Centrum voor Wiskunde en Informatica">CWI</abbr></a>/<a href= 
"http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>&#174;</sup><br />
 <a href="mailto:tvraman@almaden.ibm.com">T. V. Raman</a>, <a href="http://www.ibm.com"><abbr title="International Business Machines">IBM</abbr> Corporation</a></dd>
</dl>

<p>Please refer to the <a href="http://www.w3.org/2003/10/REC-xml-events-20031014-errata"><strong>errata</strong></a> for this document, which may include some normative corrections.</p>

<p>This document is also available in these non-normative formats: <a href="xml-events.ps">PostScript version</a>, <a href="xml-events.pdf">PDF version</a>, <a href="xml-events.zip">ZIP archive</a>,
and <a href="xml-events.tgz">Gzip'd TAR archive</a>.</p>

<p>The English version of this specification is the only normative version. Non-normative <a href="http://www.w3.org/Consortium/Translation/">translations</a> may also be available.</p>

<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &#169; 2007 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">
W3C</acronym></a><sup>&#174;</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title= 
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href= 
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href= 
"http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div>

<hr />
<h2><a id="abstract" name="abstract">Abstract</a></h2>

<p>The XML Events module defined in this specification provides XML languages with the ability to uniformly integrate event listeners and associated event handlers with Document Object Model (DOM)
Level 2 event interfaces [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>]. The result is to provide an interoperable way of associating behaviors with document-level markup.</p>

<h2><a id="status" name="status">Status of This Document</a></h2>

<p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of
this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>

<p>This document is a Working Draft. It reflects clarifications and corrections as a result of many years of use by the community. It also includes updated implementations in XML Schema and XML DTD
that can readily integrate with the host language's namespace. This document should in no way be considered stable, and should not be normatively referenced for any purposes whatsoever.</p>

<p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in progress.</p>

<p>This document has been produced by the <a class="member" href="http://www.w3.org/MarkUp/Group/">W3C HTML Working Group</a> (<em><a href="http://cgi.w3.org/MemberAccess/AccessRequest">Members
only</a></em>) as part of the <a href="http://www.w3.org/MarkUp/Activity">HTML Activity</a>. The goals of the HTML Working Group are discussed in the <a href="http://www.w3.org/2002/05/html/charter">
HTML Working Group charter</a>.</p>

<p>This document is governed by the <a href="http://www.w3.org/TR/2002/NOTE-patent-practice-20020124">24 January 2002 CPP</a> as amended by the <a href="http://www.w3.org/2004/02/05-pp-transition">
W3C Patent Policy Transition Procedure</a>. W3C maintains a <a rel="disclosure" href="http://www.w3.org/MarkUp/2002/Disclosures">public list of any patent disclosures</a> made in connection with the
deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href= 
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href= 
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>

<p>Please report errors in this specification to <a href="mailto:www-html-editor@w3.org">www-html-editor@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-html-editor/">archive</a>). It is
inappropriate to send discussion email to this address. Public discussion may take place on <a href="mailto:www-html@w3.org">www-html@w3.org</a> (<a href=
"http://lists.w3.org/Archives/Public/www-html/">archive</a>).</p>

<h1><a id="contents" name="contents">Contents</a></h1>

<div class="toc">
<ul class='toc'>
<li class='tocline'>1. <a href="#s_intro" class="tocxref">Introduction</a></li>

<li class='tocline'>2. <a href="#s_event_module_conformance" class="tocxref">Conformance Requirements</a> 

<ul class="toc">
<li class='tocline'>2.1. <a href="#docconf" class="tocxref">Document Conformance</a></li>

<li class='tocline'>2.2. <a href="#hostconf" class="tocxref">Host Language Conformance</a></li>

<li class='tocline'>2.3. <a href="#uaconf" class="tocxref">User Agent Conformance</a></li>
</ul>
</li>

<li class='tocline'>3. <a href="#s_event_module_elements" class="tocxref">The XML Events Module</a> 

<ul class="toc">
<li class='tocline'>3.1. <a href="#section-listener-element" class="tocxref">The listener Element</a> 

<ul class="toc">
<li class='tocline'>3.1.1. <a href="#sec_3.1.1." class="tocxref">Examples of listener Usage</a></li>
</ul>
</li>

<li class='tocline'>3.2. <a href="#section-listener-observer" class="tocxref">Attaching Attributes Directly to the Observer Element</a> 

<ul class="toc">
<li class='tocline'>3.2.1. <a href="#sec_3.2.1." class="tocxref"> Examples of Using Attributes Attached to an Observer Element</a></li>
</ul>
</li>

<li class='tocline'>3.3. <a href="#section-listener-handler" class="tocxref">Attaching Attributes Directly to the Handler Element</a> 

<ul class="toc">
<li class='tocline'>3.3.1. <a href="#sec_3.3.1." class="tocxref"> Examples of Using Attributes Attached to a Handler Element</a></li>
</ul>
</li>

<li class='tocline'>3.4. <a href="#section-attributedefaulting" class="tocxref">Summary of Observer and Handler Attribute Defaulting</a></li>

<li class='tocline'>3.5. <a href="#section-eventhandlers" class="tocxref">Event Handlers</a></li>

<li class='tocline'>3.6. <a href="#section-basic" class="tocxref">The Basic XML Events Profile</a></li>
</ul>
</li>

<li class='tocline'>4. <a href="#s_handler_module_elements" class="tocxref">The XML Handlers Module</a> 

<ul class="toc">
<li class='tocline'>4.1. <a href="#section-action-element" class="tocxref">The action Element</a></li>

<li class='tocline'>4.2. <a href="#section-script-element" class="tocxref">The script Element</a></li>

<li class='tocline'>4.3. <a href="#section-dispatchEvent-element" class="tocxref">The dispatchEvent Element</a></li>

<li class='tocline'>4.4. <a href="#section-addEventListener-element" class="tocxref">The addEventListener element</a></li>

<li class='tocline'>4.5. <a href="#section-removeEventListener-element" class="tocxref">The removeEventListener element</a></li>

<li class='tocline'>4.6. <a href="#section-stopPropagation-element" class="tocxref">The stopPropagation element</a></li>

<li class='tocline'>4.7. <a href="#section-preventDefault-element" class="tocxref">The preventDefault element</a></li>
</ul>
</li>

<li class='tocline'>5. <a href="#section-event-naming" class="tocxref">Naming Event Types</a></li>

<li class='tocline'>6. <a href="#section-xpath-expressions" class="tocxref">XPath Expressions</a> 

<ul class="toc">
<li class='tocline'>6.1. <a href="#xpath-function-library" class="tocxref">Function Library</a> 

<ul class="toc">
<li class='tocline'>6.1.1. <a href="#xpath-event-function" class="tocxref">XPath event Function</a></li>
</ul>
</li>
</ul>
</li>

<li class='tocline'>A. <a href="#a_DTD_definition" class="tocxref">DTD Implementation</a> 

<ul class="toc">
<li class='tocline'>A.1. <a href="#a_module_qname" class="tocxref">Qualified Names Module</a></li>

<li class='tocline'>A.2. <a href="#a_module_xml_events" class="tocxref">XML Events Module</a></li>

<li class='tocline'>A.3. <a href="#a_module_xml_handlers" class="tocxref">XML Handlers Module</a></li>
</ul>
</li>

<li class='tocline'>B. <a href="#a_Schema_definition" class="tocxref">Schema Implementation</a> 

<ul class="toc">
<li class='tocline'>B.1. <a href="#a_schema_attribs" class="tocxref">Attributes Module</a></li>

<li class='tocline'>B.2. <a href="#a_schema_xml_events" class="tocxref">XML Events Module</a></li>

<li class='tocline'>B.3. <a href="#a_schema_xml_handlers" class="tocxref">XML Handlers Module</a></li>
</ul>
</li>

<li class='tocline'>C. <a href="#s_implnotes" class="tocxref">Implementation Notes</a></li>

<li class='tocline'>D. <a href="#s_refs" class="tocxref">References</a> 

<ul class="toc">
<li class='tocline'>D.1. <a href="#s_norm-refs" class="tocxref">Normative References</a></li>

<li class='tocline'>D.2. <a href="#s_other-refs" class="tocxref">Other References</a></li>
</ul>
</li>

<li class='tocline'>E. <a href="#s_acks" class="tocxref">Acknowledgments</a></li>
</ul>
</div>

<!--OddPage-->
<h1><a id="s_intro" name="s_intro">1.Introduction</a></h1>

<p><em>This section is informative.</em></p>

<p>An <em>event</em> is the representation of some asynchronous occurrence (such as a mouse click on the presentation of the element, or an arithmetical error in the value of an attribute of the
element, or any of unthinkably many other possibilities) that gets associated with an element (<em>targeted</em> at it) in an XML document.</p>

<p>In the DOM model of events [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>], the general behavior is that when an event occurs it is <em>dispatched</em> by passing it down the document tree
in a phase called <em>capture</em> to the element where the event occurred (called its <em>target</em>), where it then may be passed back up the tree again in the phase called <em>bubbling</em>. In
general an event can be responded to at any element in the path (an <em>observer</em>) in either phase by causing an action, and/or by stopping the event, and/or by cancelling the default action for
the event. The following diagram illustrates this:</p>

<p><img src="images/event-flow.png" alt="Event propagation flow diagram" longdesc="#event-flow-desc" /><br />
<em id="event-flow-desc">Event flow in DOM2: an event targeted at an element (marked 'target') in the tree passes down the tree from the root to the target in the phase called 'capture'. If the event
type allows it, the event then travels back up the tree by the same route in a phase called 'bubbling'. Any node in the route, including the root node and the target, may be an 'observer': that is to
say, a handler may be attached to it that is activated when the event passes through in either phase. A handler can only listen for one phase. To listen for both you have to attach two
handlers.</em></p>

<p>An <em>action</em> is some way of responding to an event; a <em>handler</em> is some specification for such an action, for instance using scripting or some other method. A <em>listener</em> is a
binding of such a handler to an event targeting some element in a document.</p>

<p>HTML [<a class="nref" href="#ref_HTML4">HTML4</a>] binds events to an element 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. This method has two main disadvantages: firstly it hardwires the events into the language, so that to add a new event, you have to make a change to the language, and secondly it forces
you to mix the content of the document with the specifications of the scripting and event handling, rather than allowing you to separate them out. SVG [<a class="nref" href="#ref_SVG">SVG</a>] uses a
similar method.</p>

<p>The process of defining a new version of HTML identified the need for an extensible event specification method. The design requirements were the following:</p>

<ul>
<li>Syntactically expose the DOM event model to an XML document [<a class="nref" href="#ref_XML">XML</a>].</li>

<li>Provide for new event types without requiring modification to the DOM or the DTD.</li>

<li>Allow for integration with other XML languages.</li>
</ul>

<p>The DOM specifies an event model that provides the following features:</p>

<ul>
<li>A generic event system,</li>

<li>Means for registering event listeners and handlers,</li>

<li>Means for routing events through a tree structure,</li>

<li>Access to context information for each event, and</li>

<li>A definition of event flow, as sketched above.</li>
</ul>

<p>The elements and attributes defined in this specification are the method of binding a DOM level 2 event at an element to an event handler. They encapsulate various aspects of the DOM level 2 event
interface, thereby providing markup-level specification of the actions to be taken during the various phases of event propagation.</p>

<p>This document neither specifies particular events, nor mandates any particular methods of specifying actions. These definitions are left to any markup language using the facilities described
here.</p>

<!--OddPage-->
<h1><a id="s_event_module_conformance" name="s_event_module_conformance">2.Conformance Requirements</a></h1>

<p>This section is <em>normative</em>.</p>

<p>The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [<a class="nref" href= 
"#ref_RFC2119">RFC2119</a>].</p>

<h2><a id="docconf" name="docconf">2.1.Document Conformance</a></h2>

<p>XML Events is not a stand-alone document type. It is intended to be integrated into other host languages such as XHTML. A conforming XML Events document is a document that requires only the
facilities described as mandatory in this specification and the facilities described as mandatory in its host language. Such a document must meet all the following criteria:</p>

<ol>
<li>
<p><span class="must">The document MUST conform to the constraints expressed in <a href="#a_Schema_definition">Appendix&#160;B - Schema Implementation</a> or <a href="#a_DTD_definition">
Appendix&#160;A - DTD Implementation</a>, combined with the constraints expressed in its host language implementation.</span></p>
</li>

<li>
<p><span class="must">If the host language does not incorporate XML Events elements and attributes into its own namespace, the document MUST contain an <code>xmlns</code> declaration for the XML
Events namespace [<a class="nref" href="#ref_XMLNAMES">XMLNAMES</a>]</span>. The namespace for XML Events is defined to be <code>http://www.w3.org/2001/xml-events</code>. An example start tag of a
root element might look like:</p>

<div class="good">
<pre>
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:ev="http://www.w3.org/2001/xml-events" &gt;
</pre>
</div>

<p>Note that we expect this namespace to revert to the namespace of the previous recommendation once development of this specification is complete.</p>
</li>
</ol>

<div class="issue">
<p id="_issue_" class="issueTitle">Chameleon Namespace</p>

This draft alludes to supporting "chameleon" use of event elements and attributes. It is not clear that this is easily supportable by implementors. It may be that these elements and attributes must
be in their own namespace.</div>

<h2><a id="hostconf" name="hostconf">2.2.Host Language Conformance</a></h2>

<p><span class="must">When XML Events are included in a host language, all of the facilities required in this specification MUST be included in the host language</span>. <span class="must">In
addition, the mandatory elements and attributes defined in this specification MUST be included in the content model of the host language</span>.</p>

<h2><a id="uaconf" name="uaconf">2.3.User Agent Conformance</a></h2>

<p><span class="must">A conforming user agent MUST support all of the features required in this specification.</span></p>

<!--OddPage-->
<h1><a id="s_event_module_elements" name="s_event_module_elements">3.The XML Events Module</a></h1>

<p><em>This section is normative.</em></p>

<p>This specification defines a module called XML Events. The XML Events module uses the XML namespace [<a class="nref" href="#ref_XMLNAMES">XMLNAMES</a>] identifier <code>
http://www.w3.org/2001/xml-events</code>.</p>

<p>Examples in this document that use the namespace prefix "<code>ev</code>" all assume an <code>xmlns</code> declaration <code>xmlns:ev="http://www.w3.org/2001/xml-events"</code> somewhere suitable
in the document involved. All examples are informative.</p>

<p>The remainder of this section describes the elements and attributes in this module, the semantics, and provides an abstract module definition as required in [<a class="nref" href=
"#ref_XHTMLMOD">XHTMLMOD</a>].</p>

<p>The XML Events Module supports the following element and attributes:</p>

<table cellpadding="3" class="moduledef" border="1" summary="Element and Attributes for XML Events Module">
<thead>
<tr>
<th>Element</th>
<th>Attributes</th>
<th>Minimal Content Model</th>
</tr>
</thead>

<tbody>
<tr>
<td><a href="#section-listener-element">listener</a></td>
<td>event (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 observer (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 targetid (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 handler (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_URI">URI</a></span>),<br />
 phase ("capture" | "default"*),<br />
 propagate ("stop" | "continue"*),<br />
 defaultAction ("cancel" | "perform"*),<br />
 if (<a href="#section-xpath-expressions">XPathExpression</a>),<br />
 while (<a href="#section-xpath-expressions">XPathExpression</a>),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])<br />
</td>
<td>EMPTY</td>
</tr>
</tbody>
</table>

<p>Implementations: <a href="#a_module_xml_events">DTD</a>, <a href="#a_schema_xml_events">XML Schema</a></p>

<h2><a id="section-listener-element" name="section-listener-element">3.1.The listener Element</a></h2>

<p>Element <code>listener</code> supports a subset of the DOM's <code>EventListener</code> interface. It is used to declare event listeners and register them with specific nodes in the DOM, and has
the following attributes:</p>

<dl>
<dt><a id="attr-listener-event">event</a></dt>

<dd>The required <code>event</code> attribute specifies the event type for which the listener is being registered.</dd>

<dt><a id="attr-listener-observer"></a>observer</dt>

<dd>The optional <code>observer</code> attribute specifies the <code>id</code> of the element with which the event listener is to be registered. If this attribute is not present, the observer is the
element that the <code>event</code> attribute is on (see later under "<a href="#section-listener-observer">Attaching Attributes Directly to the Observer Element</a>"), or the parent of that element
(see later under "<a href="#section-listener-handler">Attaching Attributes Directly to the Handler Element</a>"). 

<p><em>EDITORS' NOTE:</em> There is a proposal that this attribute should be a URI. This is still under discussion, and we recognise that there may be security issues to resolve. However, if they can
be addressed then we generally support this.</p>
</dd>

<dt><a id="attr-listener-targetid">targetid</a></dt>

<dd>The optional <code>targetid</code> attribute specifies the <code>id</code> of the target element of the event (i.e., the node that caused the event). If this attribute is present, only events
that match both the <code>event</code> and <code>targetid</code> attributes will be processed by the associated event handler. Clearly because of the way events propagate, the target element should
be a descendent node of the observer element, or the observer element itself. 

<p>Use of this attribute requires care; for instance, if you specify</p>

<pre>
&lt;listener event="click" observer="para1"
     targetid="link1" handler="#clicker"/&gt;
</pre>

<p>where 'para1' is some ancestor of the following node</p>

<pre>
&lt;a id="link1" href="doc.html"&gt;The &lt;em&gt;draft&lt;/em&gt; document&lt;/a&gt;
</pre>

<p>and the user happens to click on the word "draft", the <code>em</code> element, and not the <code>a</code>, will be the target, and so the handler will not be activated; to catch all mouse clicks
on the <code>a</code> element and its children, use <code>observer="link1"</code>, and no <code>targetid</code> attribute.</p>
</dd>

<dt><a id="attr-listener-handler">handler</a></dt>

<dd>The optional <code>handler</code> attribute specifies the URI reference of a resource that defines the action that should be performed if the event reaches the observer. (This specification does
not mandate what form that element should take: see further the section "<a href="#section-eventhandlers">Event Handlers</a>"). If this attribute is not present, the handler is the element that the
<code>event</code> attribute is on (see later under "<a href="#section-listener-handler">Attaching Attributes Directly to the Handler Element</a>").</dd>

<dt><a id="attr-listener-phase">phase</a></dt>

<dd>The optional <code>phase</code> attribute specifies when (during which DOM 2 event propagation phase) the listener will be activated by the desired event. 

<dl>
<dt><code>capture</code></dt>

<dd>Listener is activated during capturing phase.</dd>

<dt><code>default</code></dt>

<dd>Listener is activated during bubbling or target phase.</dd>
</dl>

<p>The default behavior is <code>phase="default"</code>.</p>

<p>Note that not all events bubble, in which case with phase="default" you can only handle the event by making the event's target the observer.</p>
</dd>

<dt><a id="attr-listener-propagate">propagate</a></dt>

<dd>The optional <code>propagate</code> attribute specifies whether after processing all listeners at the current node, the event is allowed to continue on its path (either in the capture or the
bubble phase). 

<dl>
<dt><code>stop</code></dt>

<dd>event propagation stops</dd>

<dt><code>continue</code></dt>

<dd>event propagation continues (unless stopped by other means, such as scripting, or by another listener).</dd>
</dl>

<p>The default behavior is <code>propagate="continue"</code>.</p>
</dd>

<dt><a id="attr-listener-defaultAction">defaultAction</a></dt>

<dd>The optional <code>defaultAction</code> attribute specifies whether after processing of all listeners for the event, the default action for the event (if any) should be performed or not. For
instance, in XHTML the default action for a mouse click on an <code>a</code> element or one of its descendents is to traverse the link. 

<dl>
<dt><code>cancel</code></dt>

<dd>if the event type is cancelable, the default action is cancelled</dd>

<dt><code>perform</code></dt>

<dd>the default action is performed (unless cancelled by other means, such as scripting, or by another listener).</dd>
</dl>

<p>The default value is <code>defaultAction="perform"</code>.</p>

<p>Note that not all events are cancelable, in which case this attribute is ignored.</p>
</dd>

<dt><a id="attr-listener-if">if</a></dt>

<dd>The optional if attribute allows a condition to be specified. This condition must be met in order for the event handler to be activated. The condition is specified using an <a href= 
"#section-xpath-expressions">XPath Expression</a>. There is no default value. 

<p>This attribute allows event handlers to be specified that respond not just to named events, but to more specific conditions, such as a mouse click with the control key pressed:</p>

<div class="example">
<pre>
&lt;listener event="click" if="event('ctrlKey') = true()"
          observer="para1"
          targetid="link1" handler="#clicker"/&gt;
</pre>
</div>

<p>The event function is described in <a href="#xpath-event-function">XPath Event Function</a>.</p>
</dd>

<dt><a id="attr-listener-while">while</a></dt>

<dd>The optional while attribute allows a condition to be specified. This condition must be met in order for the event handler to be activated. The condition is specified using an <a href= 
"#section-xpath-expressions">XPath Expression</a>. There is no default value. 

<p>This attribute allows event handlers to be specified that perform their action whilst some condition remains true.</p>

<p><em>EDITORS' NOTE:</em> Can't think of an example that only makes use of what we have in this spec, i.e., the event() function. We may need to do something like delete a list in XForms.</p>
</dd>
</dl>

<p>Note that <code>observer = "&lt;element-id&gt;"</code> and <code>event = "&lt;event-type&gt;"</code> are similar to the <code>begin = "&lt;element-id&gt;.&lt;event-type&gt;"</code> attribute in
SMIL EventTiming [<a class="nref" href="#ref_SMIL20">SMIL20</a>].</p>

<h3><a id="sec_3.1.1." name="sec_3.1.1.">3.1.1.Examples of listener Usage</a></h3>

<ol>
<li>
<p>This example attaches the handler in the element at <code>"#doit"</code> that will get activated when the event called <code>activate</code> occurs on the element with <code>id="button1"</code>,
or any of its children. The activation will occur during bubbling, or if the event happened on the observer element itself, when the event reaches the element (phase <em>target</em>).</p>

<pre>
&lt;listener event="activate" observer="button1" handler="#doit"/&gt;
</pre>
</li>

<li>
<p>This attaches the handler at <code>#overflow-handler</code> that will get activated when the event <code>overflow</code> occurs on the element with <code>id="expr1"</code> and bubbles up to the
element with <code>id="prog1"</code>.</p>

<pre>
&lt;listener event="overflow" observer="prog1" targetid="expr1"
        handler="#overflow-handler"/&gt;
</pre>
</li>

<li>
<p>This attaches the handler at <code>#popup</code> that will get activated whenever an <code>activate</code> event occurs at the element with <code>id="embargo"</code> or any of its children. Since
it will be activated during the capture phase, and propagation is stopped, this will have the effect (regardless of what the handler does) of preventing any child elements of the <code>embargo</code>
element seeing any <code>activate</code> events.</p>

<pre>
&lt;listener event="activate" observer="embargo" handler="#popup"
        phase="capture" propagate="stop"/&gt;
</pre>
</li>

<li>
<p>This attaches a handler from another document.</p>

<pre>
&lt;listener event="activate" observer="image1"
    handler="/handlers/events.xml#activate"/&gt;
</pre>
</li>
</ol>

<h2><a id="section-listener-observer" name="section-listener-observer">3.2.Attaching Attributes Directly to the Observer Element</a></h2>

<p>All the attributes from the <code>listener</code> element with the exception of <code>id</code> may be used as global attributes, as defined in <em>Namespaces in XML</em> [<a class="nref" href= 
"#ref_XMLNAMES">XMLNAMES</a>], to attach the attributes to other elements.</p>

<p>Note that this means that the <code>listener</code> element is strictly speaking redundant, since the following</p>

<pre>
&lt;anyelement ev:event="click" ev:observer="button1" ev:handler="#clicker"/&gt;
</pre>

<p>would have the same effect as</p>

<pre>
&lt;ev:listener event="click" observer="button1" handler="#clicker"/&gt;
</pre>

<p>Nonetheless, for utility the <code>listener</code> element has been retained.</p>

<p>If the <code>observer</code> attribute is omitted (but not the <code>handler</code> attribute), then the element that the other attributes are attached to is the observer element.</p>

<h3><a id="sec_3.2.1." name="sec_3.2.1.">3.2.1. Examples of Using Attributes Attached to an Observer Element</a></h3>

<ol>
<li>
<p>This first example will attach the handler identified by <code>"#popper"</code> to the <code>a</code> element, and cancel the default action for the event.</p>

<pre>
&lt;a href="doc.html" ev:event="activate" ev:handler="#popper"
   ev:defaultAction="cancel"&gt;The document&lt;/a&gt;
</pre>
</li>

<li>
<p>This will attach the handler at <code>#handle-overflow</code> for the event <code>overflow</code> to the current element.</p>

<pre>
&lt;div ev:event="overflow" ev:handler="#handle-overflow"&gt; ... &lt;/div&gt;
</pre>
</li>
</ol>

<h2><a id="section-listener-handler" name="section-listener-handler">3.3.Attaching Attributes Directly to the Handler Element</a></h2>

<p>If, when attaching the global attributes to an element, the <code>handler</code> attribute is omitted then the element that the other attributes are attached to is the handler element.</p>

<p>Note that, since the <code>observer</code> and <code>targetid</code> attributes are IDREFs, in this case the handler and observer/target elements must be in the same document (while in other
cases, since the <code>handler</code> attribute is a URI, the handler element may be in another document).</p>

<p>If the <code>observer</code> attribute is also omitted, then the parent of the handler element is the observer element.</p>

<h3><a id="sec_3.3.1." name="sec_3.3.1.">3.3.1. Examples of Using Attributes Attached to a Handler Element</a></h3>

<ol>
<li>
<p>In this case the element is the handler for the <code>submit</code> event on the element with <code>id="form1"</code>.</p>

<pre>
&lt;script type="application/x-javascript"
        ev:event="submit" ev:observer="form1"&gt;
   return docheck(event);
&lt;/script&gt;
</pre>
</li>

<li>
<p>In this case the <code>action</code> element is the handler for event <code>q-submit</code>, and the observer is the <code>questionnaire</code> element.</p>

<pre>
&lt;questionnaire submissionURL="/q/tally"&gt;
    &lt;action ev:event="q-submit"&gt;
      ...
    &lt;/action&gt;
    ...
 &lt;/questionnaire&gt;
</pre>
</li>

<li>
<p>The <code>script</code> element is the handler for event <code>click</code>; the <code>img</code> element is the observer.</p>

<pre>
&lt;img src="button.gif" alt="OK"&gt;
    &lt;script ev:event="activate" type="application/x-javascript"&gt;
        doactivate(event);
    &lt;/script&gt;
&lt;/img&gt;
</pre>
</li>

<li>
<p>The <code>onevent</code> element is the handler for event <code>enterforward</code>. The <code>card</code> element is the observer.</p>

<pre>
&lt;card&gt;
    &lt;onevent ev:event="enterforward"&gt;
        &lt;go href="/url"/&gt;
    &lt;/onevent&gt;
    &lt;p&gt;
      Hello!
    &lt;/p&gt;
&lt;/card&gt;
</pre>
</li>

<li>
<p>The <code>catch</code> element is the handler for the <code>nomatch</code> event. The observer is the <code>field</code> element.</p>

<pre>
&lt;form id="launch_missiles"&gt;
  &lt;field name="password"&gt;
    &lt;prompt&gt;What is the code word?&lt;/prompt&gt;
    &lt;grammar&gt;
      &lt;rule id="root" scope="public"&gt;rutabaga&lt;/rule&gt;
    &lt;/grammar&gt;
    &lt;help&gt;It is the name of an obscure vegetable.&lt;/help&gt;
    &lt;catch ev:event="nomatch"&gt;
      &lt;prompt&gt;Security violation!&lt;/prompt&gt;
      &lt;submit next="apprehend_felon" namelist="user_id"/&gt;
    &lt;/catch&gt;
  &lt;/field&gt;
  &lt;block&gt;
    &lt;goto next="#get_city"/&gt;
  &lt;/block&gt;
&lt;/form&gt;
</pre>
</li>

<li>
<p>This example shows three handlers for different events. The observer for all three is the <code>secret</code> element.</p>

<pre>
&lt;secret ref="/login/password"&gt;
    &lt;caption&gt;Please enter your password&lt;/caption&gt;
    &lt;info ev:event="help"&gt;
        Mail help@example.com in case of problems
    &lt;/info&gt;
    &lt;info ev:event="hint"&gt;
        A pet's name
    &lt;/info&gt;
    &lt;info ev:event="alert"&gt;
        This field is required
    &lt;/info&gt;
&lt;/secret&gt;
</pre>
</li>
</ol>

<h2><a id="section-attributedefaulting" name="section-attributedefaulting">3.4.Summary of Observer and Handler Attribute Defaulting</a></h2>

<p>The following table summarizes which elements play the role of observer or handler if the relevant attribute is omitted.</p>

<table cellpadding="3" border="1" summary="The effect of omitted observer and handler attributes">
<caption>The effect of omitted observer and handler attributes</caption>

<tbody>
<tr>
<td></td>
<th>Handler present</th>
<th>Handler omitted</th>
</tr>

<tr>
<th>Observer present</th>
<td>(As declared)</td>
<td>Element is handler</td>
</tr>

<tr>
<th>Observer omitted</th>
<td>Element is observer</td>
<td>Element is handler<br />
 Parent is observer</td>
</tr>
</tbody>
</table>

<h2><a id="section-eventhandlers" name="section-eventhandlers">3.5.Event Handlers</a></h2>

<p>This specification does not require an XML application that uses XML Events to use any particular method for specifying handlers. However, the examples, particularly those in the section on
attaching the attributes directly to the handler, are intended to give examples of how they could be specified.</p>

<p>It is however recognized that two methods are likely to occur often: scripting (such as XHTML's &lt;script&gt; element) and declarative markup using XML elements (such as WML's &lt;onevent&gt;
element). Section 4 of this specification provides markup to support these methods.</p>

<h2><a id="section-basic" name="section-basic">3.6.The Basic XML Events Profile</a></h2>

<p>The Basic XML Events Profile allows restrictions on the usage of the XML Events Module in order to make processing easier on small devices.</p>

<p>The Basic Profile allows the following restrictions on the use of <code>listener</code> element and its attributes, and on the use of the attributes from the <code>listener</code> element as
global attributes.</p>

<ol>
<li>
<p>External Event Handlers</p>

<p>The ability to process external event handlers is not required. When the 'handler' attribute on the <code>listener</code> element is used, or when the global 'handler' attribute is used, the
handler specified in the value of that attribute should be within the current document.</p>

<p>For example, the following is allowed:</p>

<pre>
&lt;listener event="click" targetid="#button1" handler="#clicker"/&gt;
</pre>

<p>while the following is not required to be processed:</p>

<pre>
&lt;listener event="click" targetid="#button1" handler="doc2.html#clicker"/&gt;
</pre>
</li>

<li>Ordering of Event Bindings 

<p>The binding of an event handler to an observer may be required to be lexically before the end of the observer element. In other words, a <code>listener</code> binding to an observer may not occur
after the closing tag of the observer element, and an event handler carrying the attributes to bind it to an observer may also not occur after the closing tag of the observer element.</p>
</li>
</ol>

<!--OddPage-->
<h1><a id="s_handler_module_elements" name="s_handler_module_elements">4.The XML Handlers Module</a></h1>

<p><em>This section is normative.</em></p>

<p>This specification also defines a module called XML Handlers. The XML Handlers module also uses the XML namespace [<a class="nref" href="#ref_XMLNAMES">XMLNAMES</a>] identifier <code>
http://www.w3.org/2001/xml-events</code>.</p>

<p>The purpose of this module is to provide a declarative way to map specific events to a series of one or more actions. Those actions are declared either by the host language (e.g., [<a class="nref"
href="#ref_XFORMS">XFORMS</a>]) or within the document using the XML Events module above. Implementing actual handlers for the events remains the perview of the host language, supported scripting
languages, etc.</p>

<p>The XML Handlers Module supports the following elements and attributes:</p>

<table cellpadding="3" class="moduledef" border="1" summary="Element and Attributes for XML Handlers Module">
<thead>
<tr>
<th>Element</th>
<th>Attributes</th>
<th>Minimal Content Model</th>
</tr>
</thead>

<tbody>
<tr>
<td><a href="#section-action-element">action</a></td>
<td>event (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 targetid (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 declare ("declare"),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>( action | script | dispatchEvent | addEventListener | removeEventListener | stopPropagation | preventDefault )+</td>
</tr>

<tr>
<td><a href="#section-script-element">script</a></td>
<td>encoding (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_Charset">Charset</a></span>),<br />
 src (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_URI">URI</a></span>),<br />
 type (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_ContentTypes">ContentTypes</a></span>),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>PCDATA</td>
</tr>

<tr>
<td><a href="#section-dispatchEvent-element">dispatchEvent</a></td>
<td>raise (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 destid (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 bubbles&#160;("bubbles"),<br />
 cancelable&#160;("cancelable"),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>EMPTY</td>
</tr>

<tr>
<td><a href="#section-addEventListener-element">addEventListener</a></td>
<td>event* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 handler* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 phase&#160;("capture"&#160;|&#160;"default"*),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>EMPTY</td>
</tr>

<tr>
<td><a href="#section-removeEventListener-element">removeEventListener</a></td>
<td>event* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 handler* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_IDREF">IDREF</a></span>),<br />
 phase&#160;("capture"&#160;|&#160;"default"*),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>EMPTY</td>
</tr>

<tr>
<td><a href="#section-stopPropagation-element">stopPropagation</a></td>
<td>event* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>EMPTY</td>
</tr>

<tr>
<td><a href="#section-preventDefault-element">preventDefault</a></td>
<td>event* (<span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QName">QName</a></span>),<br />
 xml:id ([<a class="nref" href="#ref_XMLID">XMLID</a>])</td>
<td>EMPTY</td>
</tr>
</tbody>
</table>

<p>Implementations: <a href="#a_module_xml_handlers">DTD</a>, <a href="#a_schema_xml_handlers">XML Schema</a></p>

<h2><a id="section-action-element" name="section-action-element">4.1.The action Element</a></h2>

<p>The <code>action</code> element is used to group event handler elements (including other <code>action</code> elements) that will act <em>in sequence</em> as handlers for an event. The <code>
action</code> element takes the following attributes:</p>

<dl>
<dt><a id="attr-action-event">event</a></dt>

<dd>The required <code>event</code> attribute specifies the event type this action will handle.</dd>

<dt><a id="attr-action-targetid">targetid</a></dt>

<dd>The optional <code>targetid</code> attribute specifies the <code>id</code> of the target element of the event (i.e., the node that caused the event). If this attribute is present, only events
that match both the <code>event</code> and <code>targetid</code> attributes will be processed by the associated event handler. Clearly because of the way events propagate, the target element should
be a descendant node of the observer element, or the observer element itself.</dd>

<dt><a id="attr-action-declare">declare</a></dt>

<dd>When present, this boolean attribute makes the current element (and any elements it may contain) a declaration only.</dd>
</dl>

<h2><a id="section-script-element" name="section-script-element">4.2.The script Element</a></h2>

<p>The <code>script</code> element contains or references <em>scripts</em> that may register one or more event handlers for a document through a <em>scripting language</em> that is supported by the
implementation.</p>

<p>The event handler(s) may be defined within the contents of the <code>script</code> element or in an external file. <span class="must">If the <code>src</code> attribute is not set, user agents MUST
interpret the contents of the element as the handler.</span> <span class="must">If the <code>src</code> has a URI value, user agents MUST ignore the element's contents and retrieve the handler via
the URI.</span></p>

<p>Note that the <code>encoding</code> attribute refers to the <span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_Charset">character encoding</a></span> of
the handler designated by the <code>src</code> attribute; it does not concern the content of the <code>script</code> element. Also note that the <code>type</code> attribute can be used to specify a
list of available implementations for the <code>script</code>, allowing the user agent to choose among them (see <code>type</code> for more details).</p>

<h2><a id="section-dispatchEvent-element" name="section-dispatchEvent-element">4.3.The dispatchEvent Element</a></h2>

<p>The <code>dispatchEvent</code> element triggers the event identified by the <code>raise</code> attribute. If the <code>destid</code> attribute is specified, it names a specific element to which to
dispatch the event. Otherwise the event is just dispatched to the "document" to be handled by any registered listener.</p>

<p>The <code>dispatchEvent</code> element also defines two additional attributes:</p>

<dl>
<dt><a id="attr-dispatchEvent-bubbles">bubbles</a></dt>

<dd>Optional boolean indicating if this event bubbles as defined in [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>]. The default value will depend on the actual event being dispatched.</dd>

<dt><a id="attr-dispatchEvent-cancelable">cancelable</a></dt>

<dd>Optional boolean indicating if this event is cancelable as defined in [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>]. The default value will depend on the actual event being
dispatched.</dd>
</dl>

<h2><a id="section-addEventListener-element" name="section-addEventListener-element">4.4.The addEventListener element</a></h2>

<p>This element allows the registration of a listener on a specific event, as defined in [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>].</p>

<h2><a id="section-removeEventListener-element" name="section-removeEventListener-element">4.5.The removeEventListener element</a></h2>

<p>The <code>removeEventListener</code> element de-registers the handler identified by the required <code>handler</code> attribute for the event identified by the required <code>event</code>
attribute.</p>

<h2><a id="section-stopPropagation-element" name="section-stopPropagation-element">4.6.The stopPropagation element</a></h2>

<p>The <code>stopPropagation</code> element is used to prevent further propagation of an event during event flow. If this method is called by any EventListener the event will cease propagating
through the tree. The event will complete dispatch to all listeners on the current EventTarget before event flow stops. This method may be used during any stage of event flow.</p>

<h2><a id="section-preventDefault-element" name="section-preventDefault-element">4.7.The preventDefault element</a></h2>

<p>If an event is cancelable, the <code>preventDefault</code> method is used to signify that the event is to be canceled, meaning any default action normally taken by the implementation as a result
of the event will not occur. If, during any stage of event flow, the <code>preventDefault</code> method is called the event is canceled. Any default action associated with the event will not occur.
Calling this method for a non-cancelable event has no effect. Once preventDefault has been called it will remain in effect throughout the remainder of the event's propagation. This method may be used
during any stage of event flow.</p>

<!--OddPage-->
<h1><a id="section-event-naming" name="section-event-naming">5.Naming Event Types</a></h1>

<p><em>This section is informative.</em></p>

<p>This specification does not normatively specify how language designers should name events (i.e., the values used in the <code>event</code> attribute).</p>

<p>However, future versions of DOM Events are likely to allow namespaced event names, so language designers are advised not to use the colon character ":" in event names.</p>

<p>A number of event types are defined in DOM 3 Events [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>], to which you should refer for their names and semantics.</p>

<!--OddPage-->
<h1><a id="section-xpath-expressions" name="section-xpath-expressions">6.XPath Expressions</a></h1>

<p>XML Events uses XPath expressions to specify conditionals (<a href="#attr-listener-if">if</a>, <a href="#attr-listener-while">while</a>). As described in section 1 of [<a class="nref" href= 
"#ref_XPATH">XPATH</a>], each XPath expression is evaluated within a context, which is made up of:</p>

<ul>
<li>a node (the context node)</li>

<li>a pair of non-zero positive integers (the context position and the context size)</li>

<li>a set of variable bindings</li>

<li>a function library</li>

<li>the set of namespace declarations in scope for the expression</li>
</ul>

<p>XML Events XPath expressions have no context node, and so the context position is 0 and the context size is 0. There are no variable bindings, and the function library contains the functions
described below. It is not necessary to provide namespace declarations.</p>

<p><span class="must">Host languages that import XML Events may provide a richer context, and MUST specify whether their context is the same as that provided here, or more.</span></p>

<h2><a id="xpath-function-library" name="xpath-function-library">6.1.Function Library</a></h2>

<p>The XPath function library consists of the following functions:</p>

<ul>
<li>event</li>
</ul>

<h3><a id="xpath-event-function" name="xpath-event-function">6.1.1.XPath event Function</a></h3>

<p><code>node-set event(string)</code></p>

<p>Function <code>event</code> returns the value of a property of the current event object, as determined by the string argument. The value returned will be typed, depending on the property. For
example, the MouseEvent interface [<a class="nref" href="#ref_DOM2EVENTS">DOM2EVENTS</a>] has the attribute <code>shiftKey</code>, which is a <code>boolean</code>. This can be accessed by passing the
string value '<code>shiftKey</code>' to the event function. The result will be an XPath boolean.</p>

<!--OddPage-->
<h1><a id="a_DTD_definition" name="a_DTD_definition">A.DTD Implementation</a></h1>

<p>This appendix is <em>normative</em>.</p>

<p>The DTD implementation of XML Events conforms to the requirements defined in [<a class="nref" href="#ref_XHTMLMOD">XHTMLMOD</a>]. Consequently, it provides a Qualified Names sub-module, and a
module file for the XML Events module defined in this Proposed Recommendation.</p>

<h2><a id="a_module_qname" name="a_module_qname">A.1.Qualified Names Module</a></h2>

<p>Note that this module defines the parameter entity <code>%xml-events-attrs.qname;</code>. This entity is intended to be used in the attribute lists of elements in any host language that permits
the use of event attributes on elements in its own namespace. In this case the Host Language driver should set a parameter entity <code>%XML-EVENTS.prefixed;</code> to <code>INCLUDE</code> and a
parameter entity <code>%XML-EVENTS.prefix;</code> to a value that is the prefix for the XML Events attributes.</p>

<pre class="dtd">
&lt;!-- ....................................................................... --&gt;
&lt;!-- XML Events Qname Module  ............................................ --&gt;
&lt;!-- file: xml-events-qname-2.mod

     This is XML Events - the Events Module for XML,
     a definition of access to the DOM events model.

     Copyright 2000-2007 W3C (MIT, ERCIM, Keio), All Rights Reserved.

     This DTD module is identified by the PUBLIC and SYSTEM identifiers:

       PUBLIC "-//W3C//ENTITIES XML Events Qnames 2.0//EN"
       SYSTEM "http://www.w3.org/MarkUp/DTD/xml-events-qname-2.mod"

     Revisions:
     (none)
     ....................................................................... --&gt;

&lt;!-- XML Events Qname (Qualified Name) Module

     This module is contained in two parts, labeled Section 'A' and 'B':

       Section A declares parameter entities to support namespace-
       qualified names, namespace declarations, and name prefixing
       for XML Events and extensions.

       Section B declares parameter entities used to provide
       namespace-qualified names for all XML Events element types:

         %listener.qname;   the xmlns-qualified name for &lt;listener&gt;
         ...

     XML Events extensions would create a module similar to this one.
     Included in the XML distribution is a template module
     ('template-qname-2.mod') suitable for this purpose.
--&gt;

&lt;!-- Section A: XML Events XML Namespace Framework :::::::::::::::::::: --&gt;

&lt;!-- 1. Declare a %XML-EVENTS.prefixed; conditional section keyword, used
        to activate namespace prefixing. The default value should
        inherit '%NS.prefixed;' from the DTD driver, so that unless
        overridden, the default behavior follows the overall DTD
        prefixing scheme.
--&gt;
&lt;!ENTITY <span class="entity">% NS.prefixed</span> "IGNORE" &gt;
&lt;!ENTITY <span class="entity">% XML-EVENTS.prefixed</span> "%NS.prefixed;" &gt;

&lt;!-- 2. Declare a parameter entity (eg., %XML-EVENTS.xmlns;) containing
        the URI reference used to identify the XML Events namespace
--&gt;
&lt;!ENTITY <span class="entity">% XML-EVENTS.xmlns</span>  "http://www.w3.org/2001/xml-events" &gt;

&lt;!-- 3. Declare parameter entities (eg., %XML.prefix;) containing
        the default namespace prefix string(s) to use when prefixing
        is enabled. This may be overridden in the DTD driver or the
        internal subset of an document instance. If no default prefix
        is desired, this may be declared as an empty string.

     NOTE: As specified in [XMLNAMES], the namespace prefix serves
     as a proxy for the URI reference, and is not in itself significant.
--&gt;
&lt;!ENTITY <span class="entity">% XML-EVENTS.prefix</span>  "" &gt;

&lt;!-- 4. Declare parameter entities (eg., %XML-EVENTS.pfx;) containing the
        colonized prefix(es) (eg., '%XML-EVENTS.prefix;:') used when
        prefixing is active, an empty string when it is not.
--&gt;
&lt;![%XML-EVENTS.prefixed;[
&lt;!ENTITY <span class="entity">% XML-EVENTS.pfx</span>  "%XML-EVENTS.prefix;:" &gt;
]]&gt;
&lt;!ENTITY <span class="entity">% XML-EVENTS.pfx</span>  "" &gt;

&lt;!-- declare qualified name extensions here ............ --&gt;
&lt;!ENTITY <span class="entity">% xml-events-qname-extra.mod</span> "" &gt;
%xml-events-qname-extra.mod;

&lt;!-- 5. The parameter entity %XML-EVENTS.xmlns.extra.attrib; may be
        redeclared to contain any non-XML Events namespace declaration
        attributes for namespaces embedded in XML. The default
        is an empty string.  XLink should be included here if used
        in the DTD.
--&gt;
&lt;!ENTITY <span class="entity">% XML-EVENTS.xmlns.extra.attrib</span> "" &gt;


&lt;!-- Section B: XML Qualified Names ::::::::::::::::::::::::::::: --&gt;

&lt;!-- 6. This section declares parameter entities used to provide
        namespace-qualified names for all XML Events element types.
--&gt;

&lt;!ENTITY <span class="entity">% xml-events.listener.qname</span>  "%XML-EVENTS.pfx;listener" &gt;


&lt;!ENTITY <span class="entity">% xml-handlers.action.qname</span>  "%XML-EVENTS.pfx;action" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.script.qname</span>  "%XML-EVENTS.pfx;script" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.dispatchEvent.qname</span>  "%XML-EVENTS.pfx;dispatchEvent" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.addEventListener.qname</span>  "%XML-EVENTS.pfx;addEventListener" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.removeEventListener.qname</span>  "%XML-EVENTS.pfx;removeEventListener" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.stopPropagation.qname</span>  "%XML-EVENTS.pfx;stopPropagation" &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.preventDefault.qname</span>  "%XML-EVENTS.pfx;preventDefault" &gt;


&lt;!-- The following defines a PE for use in the attribute sets of elements in
     other namespaces that want to incorporate the XML Event attributes. Note
     that in this case the XML-EVENTS.pfx should always be defined. --&gt;

&lt;!ENTITY <span class="entity">% xml-events.attrs.qname</span>
   "%XML-EVENTS.pfx;event            NMTOKEN      #IMPLIED
    %XML-EVENTS.pfx;observer         IDREF        #IMPLIED
    %XML-EVENTS.pfx;target           IDREF        #IMPLIED
    %XML-EVENTS.pfx;handler          %URI.datatype;        #IMPLIED
    %XML-EVENTS.pfx;phase            (capture|default) #IMPLIED
    %XML-EVENTS.pfx;propagate        (stop|continue) #IMPLIED
    %XML-EVENTS.pfx;defaultAction    (cancel|perform) #IMPLIED
    %XML-EVENTS.pfx;condition        CDATA        #IMPLIED"
    &gt;

&lt;!-- end of xml-events-qname-2.mod --&gt;

</pre>

<h2><a id="a_module_xml_events" name="a_module_xml_events">A.2.XML Events Module</a></h2>

<pre class="dtd">
&lt;!-- ...................................................................... --&gt;
&lt;!-- XML Events Module .................................................... --&gt;
&lt;!-- file: xml-events-2.mod

     This is XML Events - the Events Module for XML.
     a redefinition of access to the DOM events model.

     Copyright 2000-2007 W3C (MIT, ERCIM, Keio), All Rights Reserved.

     This DTD module is identified by the PUBLIC and SYSTEM identifiers:

       PUBLIC "-//W3C//ENTITIES XML Events 2.0//EN"
       SYSTEM "http://www.w3.org/MarkUp/DTD/xml-events-2.mod"

     Revisions:
     (none)
     ....................................................................... --&gt;


&lt;!-- XML Events defines the listener element and its attributes --&gt;

&lt;!ENTITY <span class="entity">% xml-events.listener.content</span> "EMPTY" &gt;

&lt;!ELEMENT <span class="element">%xml-events.listener.qname;</span> %xml-events.listener.content;&gt;
&lt;!ATTLIST %xml-events.listener.qname;
    xml:id           ID           #IMPLIED
    event            NMTOKEN      #REQUIRED
    observer         IDREF        #IMPLIED
    targetid         IDREF        #IMPLIED
    handler          %anyURI.datatype;        #IMPLIED
    phase            (capture|default) #IMPLIED
    propagate        (stop|continue) #IMPLIED
    condition        CDATA        #IMPLIED
&gt;

&lt;!-- end of xml-events-2.mod --&gt;

</pre>

<h2><a id="a_module_xml_handlers" name="a_module_xml_handlers">A.3.XML Handlers Module</a></h2>

<pre class="dtd">
&lt;!-- ................................................................... --&gt;
&lt;!-- XML Handlers Module ............................................... --&gt;
&lt;!-- file: xml-handlers-2.mod

     This is XML Handlers - the Handlers Module for XML.
     a redefinition of support for handlers of the DOM event model.

     Copyright 2007 W3C (MIT, ERCIM, Keio), All Rights Reserved.

     This DTD module is identified by the PUBLIC and SYSTEM identifiers:

       PUBLIC "-//W3C//ENTITIES XML Handlers 2.0//EN"
       SYSTEM "http://www.w3.org/MarkUp/DTD/xml-handlers-2.mod"

     Revisions:
     (none)
     ....................................................................... --&gt;


&lt;!-- XML Handlers defines the various element and attributes --&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.action.content</span> 
    "( %xml-handlers.action.qname; |
       %xml-handlers.script.qname; |
       %xml-handlers.dispatchevent.qname; |
       %xml-handlers.addEventListener.qname; |
       %xml-handlers.removeEventListener.qname; |
       %xml-handlers.stopPropagation.qname; |
       %xml-handlers.preventDefault.qname; |
       %xml-handlers.action.extras; )+ "
&gt;

&lt;!ELEMENT <span class="element">%xml-handlers.action.qname;</span> %xml-handlers.action.content;&gt;
&lt;!ATTLIST %xml-handlers.action.qname;
    xml:id           ID                   #IMPLIED
    event            %QName.datatype;     #IMPLIED
    targetid         IDREF                #IMPLIED
    declare          ( declare )          #IMPLIED
    condition        CDATA                #IMPLIED
    while            CDATA                #IMPLIED
&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.script.content</span> "( #PCDATA )" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.script.qname;</span> %xml-handlers.script.content; &gt;
&lt;!ENTITY <span class="entity">% xml-handlers.script.attlist</span>  "INCLUDE" &gt;
&lt;![%xml-handlers.script.attlist;[
&lt;!ATTLIST %xml-handlers.script.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      charset      %Charset.datatype;       #IMPLIED
      type         %ContentType.datatype;   #REQUIRED
      src          %URI.datatype;           #IMPLIED
      defer        ( defer )                #IMPLIED
&gt;
&lt;!-- end of xml-handlers.script.attlist --&gt;]]&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.dispatchEvent.content</span> "NONE" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.dispatchEvent.qname;</span> 
          %xml-handlers.dispatchEvent.content &gt;

&lt;ENTITY % xml-handlers.dispatchEvent.attlist "INCLUDE" &gt;
&lt;![%xml-handlers.dispatchEvent.attlist;[
&lt;!ATTLIST %xml-handlers.dispatchEvent.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      destid       IDREF                    #IMPLIED
      raise        %QName.datatype;         #IMPLIED
      bubbles      ( bubbles )              #IMPLIED
      cancelable   ( cancelable )           #IMPLIED
&gt;
&lt;!-- end of xml-handlers.dispatchEvent.attlist --&gt;]]&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.addEventListener.content</span> "NONE" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.addEventListener.qname;</span> 
          %xml-handlers.addEventListener.content &gt;

&lt;ENTITY % xml-handlers.addEventListener.attlist "INCLUDE" &gt;
&lt;![%xml-handlers.addEventListener.attlist;[
&lt;!ATTLIST %xml-handlers.addEventListener.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      event        %QName.datatype;         #REQUIRED
      handler      IDREF                    #REQUIRED
      phase        (capture|default)        #IMPLIED
&gt;
&lt;!-- end of xml-handlers.addEventListener.attlist --&gt;]]&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.removeEventListener.content</span> "NONE" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.removeEventListener.qname;</span> 
          %xml-handlers.removeEventListener.content &gt;

&lt;ENTITY % xml-handlers.removeEventListener.attlist "INCLUDE" &gt;
&lt;![%xml-handlers.removeEventListener.attlist;[
&lt;!ATTLIST %xml-handlers.removeEventListener.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      event        %QName.datatype;         #REQUIRED
      handler      IDREF                    #REQUIRED
      phase        (capture|default)        #IMPLIED
&gt;
&lt;!-- end of xml-handlers.addEventListener.attlist --&gt;]]&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.stopPropagation.content</span> "NONE" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.stopPropagation.qname;</span> 
          %xml-handlers.stopPropagation.content &gt;

&lt;ENTITY % xml-handlers.stopPropagation.attlist "INCLUDE" &gt;
&lt;![%xml-handlers.stopPropagation.attlist;[
&lt;!ATTLIST %xml-handlers.stopPropagation.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      event        %QName.datatype;         #REQUIRED
&gt;
&lt;!-- end of xml-handlers.stopPropagation.attlist --&gt;]]&gt;

&lt;!ENTITY <span class="entity">% xml-handlers.preventDefault.content</span> "NONE" &gt;
&lt;!ELEMENT <span class="element">%xml-handlers.preventDefault.qname;</span> 
          %xml-handlers.preventDefault.content &gt;

&lt;ENTITY % xml-handlers.preventDefault.attlist "INCLUDE" &gt;
&lt;![%xml-handlers.preventDefault.attlist;[
&lt;!ATTLIST %xml-handlers.preventDefault.qname;
      %XML-EVENTS.xmlns.attrib;
      xml:id       ID                       #IMPLIED
      event        %QName.datatype;         #REQUIRED
&gt;
&lt;!-- end of xml-handlers.preventDefault.attlist --&gt;]]&gt;

&lt;!-- end of xml-handlers-2.mod --&gt;

</pre>

<!--OddPage-->
<h1><a id="a_Schema_definition" name="a_Schema_definition">B.Schema Implementation</a></h1>

<p>This appendix is <em>normative</em>.</p>

<p>The schema implementation of XML Events conforms to the requirements defined in [<a class="nref" href="#ref_XHTMLSCHEMAMOD">XHTMLSCHEMAMOD</a>]. It is divided into an attributes module and an
element module for the XML Events module defined in this Proposed Recommendation.</p>

<h2><a id="a_schema_attribs" name="a_schema_attribs">B.1.Attributes Module</a></h2>

<!-- INCLUDING SCHEMA SCHEMA/xml-events-attribs-2.xsd.mhtml -->
<pre class="dtd">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema 
    targetNamespace="http://www.w3.org/2001/xml-events" 
    xmlns:ev="http://www.w3.org/2001/xml-events" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema 
                        http://www.w3.org/2001/XMLSchema.xsd" 
    elementFormDefault="unqualified" 
    blockDefault="#all" 
    finalDefault="#all" 
    attributeFormDefault="unqualified"&gt;

  &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;
      This is the XML Schema for XML Events global attributes

      URI: http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-2.xsd
      $Id: Overview.html,v 1.1 2007/02/15 22:01:09 jean-gui Exp $
      $Id: Overview.html,v 1.2 2007/11/14 17:09:48 jigsaw Exp $
    &lt;/xs:documentation&gt;
    &lt;xs:documentation source="xml-events-copyright-2.xsd"/&gt;
  &lt;/xs:annotation&gt;

  &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;
      XML Event Attributes
        
        These "global" event attributes are defined in "Attaching
        Attributes Directly to the Observer Element" of the XML
        Events specification.
    &lt;/xs:documentation&gt;
  &lt;/xs:annotation&gt;

  &lt;xs:attribute name="event" type="xs:NMTOKEN"/&gt;
  &lt;xs:attribute name="observer" type="xs:IDREF"/&gt;
  &lt;xs:attribute name="target" type="xs:IDREF"/&gt;
  &lt;xs:attribute name="handler" type="xs:anyURI"/&gt;
  &lt;xs:attribute name="condition" type="xs:normalizedString"/&gt;
  &lt;xs:attribute name="phase" default="default"&gt;
    &lt;xs:simpleType&gt;
      &lt;xs:restriction base="xs:NMTOKEN"&gt;
        &lt;xs:enumeration value="capture"/&gt;
        &lt;xs:enumeration value="default"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
  &lt;/xs:attribute&gt;
  &lt;xs:attribute name="propagate" default="continue"&gt;
    &lt;xs:simpleType&gt;
      &lt;xs:restriction base="xs:NMTOKEN"&gt;
        &lt;xs:enumeration value="stop"/&gt;
        &lt;xs:enumeration value="continue"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
  &lt;/xs:attribute&gt;
  &lt;xs:attribute name="defaultAction" default="perform"&gt;
    &lt;xs:simpleType&gt;
      &lt;xs:restriction base="xs:NMTOKEN"&gt;
        &lt;xs:enumeration value="cancel"/&gt;
        &lt;xs:enumeration value="perform"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
  &lt;/xs:attribute&gt;

  &lt;xs:attributeGroup name="XmlEvents.attlist"&gt;
    &lt;xs:attribute ref="ev:event"/&gt;
    &lt;xs:attribute ref="ev:observer"/&gt;
    &lt;xs:attribute ref="ev:target"/&gt;
    &lt;xs:attribute ref="ev:handler"/&gt;
    &lt;xs:attribute ref="ev:condition"/&gt;
    &lt;xs:attribute ref="ev:phase"/&gt;
    &lt;xs:attribute ref="ev:propagate"/&gt;
    &lt;xs:attribute ref="ev:defaultAction"/&gt;
  &lt;/xs:attributeGroup&gt;

&lt;/xs:schema&gt;

</pre>

<!-- END OF FILE SCHEMA/xml-events-attribs-2.xsd.mhtml -->
<h2><a id="a_schema_xml_events" name="a_schema_xml_events">B.2.XML Events Module</a></h2>

<!-- INCLUDING SCHEMA SCHEMA/xml-events-2.xsd.mhtml -->
<pre class="dtd">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema 
    targetNamespace="http://www.w3.org/2001/xml-events" 
    xmlns="http://www.w3.org/2001/xml-events" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema 
                        http://www.w3.org/2001/XMLSchema.xsd" 
    elementFormDefault="unqualified" 
    blockDefault="#all" 
    finalDefault="#all" 
    attributeFormDefault="unqualified"&gt;

  &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;
      This is the XML Schema for XML Events

      URI: http://www.w3.org/MarkUp/SCHEMA/xml-events-2.xsd
      $Id: Overview.html,v 1.1 2007/02/15 22:01:09 jean-gui Exp $
      $Id: Overview.html,v 1.2 2007/11/14 17:09:48 jigsaw Exp $
    &lt;/xs:documentation&gt;
    &lt;xs:documentation source="xml-events-copyright-2.xsd"/&gt;
  &lt;/xs:annotation&gt;

  &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;
      XML Events element listener
        
        This module defines the listener element for XML Events.
        This element can be used to define event listeners. This
        module relies upon the XmlEvents.attlist attribute group
        defined in xml-events-attribs-2.xsd.
    &lt;/xs:documentation&gt;
  &lt;/xs:annotation&gt;

  &lt;xs:attributeGroup name="listener.attlist"&gt;
    &lt;xs:attribute name="event" use="required" type="xs:NMTOKEN"/&gt;
    &lt;xs:attribute name="observer" type="xs:IDREF"/&gt;
    &lt;xs:attribute name="target" type="xs:IDREF"/&gt;
    &lt;xs:attribute name="handler" type="xs:anyURI"/&gt;
    &lt;xs:attribute name="condition" type="xs:normalizedString"/&gt;
    &lt;xs:attribute name="phase" default="default"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="capture"/&gt;
          &lt;xs:enumeration value="default"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="propagate" default="continue"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="stop"/&gt;
          &lt;xs:enumeration value="continue"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="defaultAction" default="perform"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="cancel"/&gt;
          &lt;xs:enumeration value="perform"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="id" type="xs:ID"/&gt;
  &lt;/xs:attributeGroup&gt;

  &lt;xs:complexType name="listener.type"&gt;
    &lt;xs:attributeGroup ref="listener.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_listener">listener</a></span>" type="listener.type"/&gt;

&lt;/xs:schema&gt;

</pre>

<!-- END OF FILE SCHEMA/xml-events-2.xsd.mhtml -->
<h2><a id="a_schema_xml_handlers" name="a_schema_xml_handlers">B.3.XML Handlers Module</a></h2>

<!-- INCLUDING SCHEMA SCHEMA/xml-handlers-2.xsd.mhtml -->
<pre class="dtd">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema 
    targetNamespace="http://www.w3.org/2001/xml-events" 
    xmlns="http://www.w3.org/2001/xml-events" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema 
                        http://www.w3.org/2001/XMLSchema.xsd" 
    elementFormDefault="unqualified" 
    blockDefault="#all" 
    finalDefault="#all" 
    attributeFormDefault="unqualified"&gt;

  &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;
      This is the XML Schema for XML Events

      URI: http://www.w3.org/MarkUp/SCHEMA/xml-handlers-2.xsd
      $Id: Overview.html,v 1.1 2007/02/15 22:01:09 jean-gui Exp $
      $Id: Overview.html,v 1.2 2007/11/14 17:09:48 jigsaw Exp $
    &lt;/xs:documentation&gt;
    &lt;xs:documentation source="xml-events-copyright-2.xsd"/&gt;
  &lt;/xs:annotation&gt;

  &lt;xs:attributeGroup name="action.attlist"&gt;
    &lt;xs:attribute name="event" use="required" type="xs:NMTOKEN"/&gt;
    &lt;xs:attribute name="observer" type="xs:IDREF"/&gt;
    &lt;xs:attribute name="target" type="xs:IDREF"/&gt;
    &lt;xs:attribute name="handler" type="xs:anyURI"/&gt;
    &lt;xs:attribute name="condition" type="xs:normalizedString"/&gt;
    &lt;xs:attribute name="phase" default="default"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="capture"/&gt;
          &lt;xs:enumeration value="default"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="propagate" default="continue"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="stop"/&gt;
          &lt;xs:enumeration value="continue"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="defaultAction" default="perform"&gt;
      &lt;xs:simpleType&gt;
        &lt;xs:restriction base="xs:NMTOKEN"&gt;
          &lt;xs:enumeration value="cancel"/&gt;
          &lt;xs:enumeration value="perform"/&gt;
        &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
    &lt;/xs:attribute&gt;
    &lt;xs:attribute name="id" type="xs:ID"/&gt;
  &lt;/xs:attributeGroup&gt;

  &lt;xs:complexType name="action.type"&gt;
    &lt;xs:attributeGroup ref="action.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_action">action</a></span>" type="action.type"/&gt;

  &lt;xs:complexType name="script.type"&gt;
    &lt;xs:attributeGroup ref="script.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_script">script</a></span>" type="script.type"/&gt;

  &lt;xs:complexType name="dispatchEvent.type"&gt;
    &lt;xs:attributeGroup ref="dispatchEvent.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_dispatchEvent">dispatchEvent</a></span>" type="dispatchEvent.type"/&gt;

  &lt;xs:complexType name="addEventListener.type"&gt;
    &lt;xs:attributeGroup ref="addEventListener.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_addEventListener">addEventListener</a></span>" type="addEventListener.type"/&gt;

  &lt;xs:complexType name="removeEventListener.type"&gt;
    &lt;xs:attributeGroup ref="removeEventListener.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_removeEventListener">removeEventListener</a></span>" type="removeEventListener.type"/&gt;

  &lt;xs:complexType name="stopPropagation.type"&gt;
    &lt;xs:attributeGroup ref="stopPropagation.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_stopPropagation">stopPropagation</a></span>" type="stopPropagation.type"/&gt;

  &lt;xs:complexType name="preventDefault.type"&gt;
    &lt;xs:attributeGroup ref="preventDefault.attlist"/&gt;
  &lt;/xs:complexType&gt;

  &lt;xs:element name="<span class="element"><a id="a_smodule_element_preventDefault">preventDefault</a></span>" type="stopPropagation.type"/&gt;
&lt;/xs:schema&gt;

</pre>

<!-- END OF FILE SCHEMA/xml-handlers-2.xsd.mhtml --><!--OddPage-->
<h1><a id="s_implnotes" name="s_implnotes">C.Implementation Notes</a></h1>

<p>This appendix is <em>informative</em>.</p>

<p>XML Events is intended as a declarative way to use DOM Events, but it is not necessarily limited to that. For example, it would be possible to use XML Events in a tree-based system that does not
support a DOM. The mapping to DOM 3 Events is straightforward, and XML Events 2 provides mark-up that reflects all features of DOM 3 Events. The mapping to DOM 2 Events is slightly more involved, and
requires some processing of event names, since in XML Events 2 event names are <span class="datatype"><a href="http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_QNames">QNames</a></span>.
DOM 2 Events allows a string for the event name, and a suggested practice is to convert the QName to a URI by concatenating the local part to the namespace, and then use the URI as the event
name.</p>

<!--OddPage-->
<h1><a id="s_refs" name="s_refs">D.References</a></h1>

<p>This appendix is <em>normative</em>.</p>

<h2><a id="s_norm-refs" name="s_norm-refs">D.1.Normative References</a></h2>

<dl>
<dt>[<a id="ref_DOM2EVENTS" name="ref_DOM2EVENTS" class="normref">DOM2EVENTS</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/DOM-Level-2-Events/">Document Object Model (DOM) Level 2 Events Specification</a></cite>", W3C Recommendation, T. Pixley, <i><abbr title="editor">
ed.</abbr></i>, 13 November 2000.<br />
Available at: http://www.w3.org/TR/DOM-Level-2-Events/<br />
The <a href="http://www.w3.org/TR/DOM-Level-2-Events">latest version</a> is available at: http://www.w3.org/TR/DOM-Level-2-Events</dd>

<dt>[<a id="ref_XML" name="ref_XML" class="normref">XML</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2000/REC-xml-20001006">Extensible Markup Language (XML) 1.0 (Second Edition)</a></cite>", W3C Recommendation, T. Bray <i lang="lt" xml:lang="lt">et al.</i>,
<i><abbr title="editors">eds.</abbr></i>, 6 October 2000.<br />
Available at: http://www.w3.org/TR/2000/REC-xml-20001006<br />
The <a href="http://www.w3.org/TR/REC-xml">latest version</a> is available at: http://www.w3.org/TR/REC-xml</dd>

<dt>[<a id="ref_SCHEMA" name="ref_SCHEMA" class="normref">SCHEMA</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">XML Schema Part 2: Datatypes</a></cite>", W3C Recommendation, P. V. Biron <i lang="lt" xml:lang="lt">et al.</i>, <i><abbr
title="editors">eds.</abbr></i>, 2 May 2001.<br />
Available at: http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/<br />
The <a href="http://www.w3.org/TR/xmlschema-2/">latest version</a> is available at: http://www.w3.org/TR/xmlschema-2/</dd>

<dt><a id="ref_RFC2119" name="ref_RFC2119" class="normref">[RFC2119]</a></dt>

<dd>"<cite><a href="http://www.rfc-editor.org/rfc/rfc2119.txt">Key words for use in RFCs to indicate requirement levels</a></cite>", RFC 2119, S. Bradner, March 1997.<br />
 Available at: http://www.rfc-editor.org/rfc/rfc2119.txt</dd>

<dt><a id="ref_XMLID" name="ref_XMLID" class="normref">[XMLID]</a></dt>

<dd>"<cite><a href="http://www.w3.org/TR/2005/CR-xml-id-20050208/">xml:id Version 1.0</a></cite>", W3C Candidate Recommendation, J. Marsh, D. Veillard, N. Walsh, <i><abbr title="editors">
eds.</abbr></i>, 8 February 2005, <em>work in progress</em>.<br />
Available at: http://www.w3.org/TR/2005/CR-xml-id-20050208/</dd>

<dt><a id="ref_XMLNAMES" name="ref_XMLNAMES" class="ref">[XMLNAMES]</a></dt>

<dd>"<cite><a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">Namespaces in XML</a></cite>", W3C Recommendation, T. Bray <i lang="lt" xml:lang="lt">et al.</i>, <i><abbr title="editors">
eds.</abbr></i>, 14 January 1999.<br />
Available at: http://www.w3.org/TR/1999/REC-xml-names-19990114<br />
The <a href="http://www.w3.org/TR/REC-xml-names">latest version</a> is available at: http://www.w3.org/TR/REC-xml-names</dd>

<dt><a id="ref_XPATH" name="ref_XPATH" class="ref">[XPATH]</a></dt>

<dd>"<cite><a href="http://www.w3.org/TR/1999/REC-xpath-19991116">XML Path Language</a></cite>", W3C Recommendation, James Clark, <i lang="lt" xml:lang="lt">et al.</i>, <i><abbr title="editors">
eds.</abbr></i>, 16 November 1999.<br />
Available at: http://www.w3.org/TR/1999/REC-xpath-19991116<br />
The <a href="http://www.w3.org/TR/xpath">latest version</a> is available at: http://www.w3.org/TR/xpath</dd>
</dl>

<h2><a id="s_other-refs" name="s_other-refs">D.2.Other References</a></h2>

<dl>
<dt>[<a id="ref_HTML4" name="ref_HTML4">HTML4</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/1999/REC-html401-19991224">HTML 4.01 Specification</a></cite>", W3C Recommendation, D. Raggett <i lang="lt" xml:lang="lt">et al.</i>, <i><abbr title=
"editors">eds.</abbr></i>, 24 December 1999.<br />
Available at: http://www.w3.org/TR/1999/REC-html401-19991224<br />
The <a href="http://www.w3.org/TR/html4">latest version</a> is available at: http://www.w3.org/TR/html4</dd>

<dt>[<a id="ref_SMIL20" name="ref_SMIL20">SMIL20</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2001/REC-smil20-20010807/">Synchronized Multimedia Integration Language (SMIL 2.0)</a></cite>", W3C Recommendation, J. Ayars <i lang="lt" xml:lang="lt">et
al.</i>, <i><abbr title="editors">eds.</abbr></i>, 7 August 2001.<br />
Available at: http://www.w3.org/TR/2001/REC-smil20-20010807/<br />
The <a href="http://www.w3.org/TR/smil20">latest version</a> is available at: http://www.w3.org/TR/smil20</dd>

<dt>[<a id="ref_SVG" name="ref_SVG">SVG</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2001/REC-SVG-20010904/">Scalable Vector Graphics (SVG) 1.0 Specification</a></cite>", W3C Recommendation, J. Ferraiolo, <i><abbr title="editor">
ed.</abbr></i>, 4 September 2001.<br />
Available at: http://www.w3.org/TR/2001/REC-SVG-20010904/<br />
The <a href="http://www.w3.org/TR/SVG/">latest version</a> is available at: http://www.w3.org/TR/SVG/</dd>

<dt>[<a id="ref_XFORMS" name="ref_XFORMS">XFORMS</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2004/WD-xforms11-20041115/">XForms 1.1</a></cite>", W3C Working Draft, M. Dubinko <i lang="la" xml:lang="la">et al.</i>, <i><abbr title="editors">
eds.</abbr></i>, 15 November 2004.<br />
Available at: http://www.w3.org/TR/2004/WD-xforms11-20041115/</dd>

<dt>[<a id="ref_XHTML" name="ref_XHTML">XHTML</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2002/REC-xhtml1-20020801">XHTML&#8482; 1.0: The Extensible HyperText Markup Language (Second Edition)</a></cite>". S. Pemberton <i lang="lt" xml:lang="lt">et
al.</i>, 26 January 2000, revised 1 August 2002.<br />
Available at: http://www.w3.org/TR/2002/REC-xhtml1-20020801<br />
The <a href="http://www.w3.org/TR/xhtml1">latest version</a> is available at: http://www.w3.org/TR/xhtml1</dd>

<dt>[<a id="ref_XHTMLMOD" name="ref_XHTMLMOD">XHTMLMOD</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2006/PR-xhtml-modularization-20060213">Modularization of XHTML&#8482; 1.1</a></cite>", W3C Proposed Recommendation, D. Austin <i lang="lt" xml:lang="lt">et
al.</i>, <i><abbr title="editors">eds.</abbr></i>, 13 February 2006.<br />
Available at: http://www.w3.org/TR/2006/PR-xhtml-modularization-20060213<br />
The <a href="http://www.w3.org/TR/xhtml-modularization">latest version</a> is available at: http://www.w3.org/TR/xhtml-modularization</dd>

<dt>[<a id="ref_XHTMLSCHEMAMOD" name="ref_XHTMLSCHEMAMOD">XHTMLSCHEMAMOD</a>]</dt>

<dd>"<cite><a href="http://www.w3.org/TR/2003/WD-xhtml-m12n-schema-20031003">Modularization of XHTML&#8482; in XML Schema</a></cite>", W3C Working Draft, D. Austin <i lang="lt" xml:lang="lt">et
al.</i>, <i><abbr title="editors">eds.</abbr></i>, 3 October 2003, <em>work in progress</em>.<br />
Available at: http://www.w3.org/TR/2003/WD-xhtml-m12n-schema-20031003<br />
The <a href="http://www.w3.org/TR/xhtml-m12n-schema">latest version</a> is available at: http://www.w3.org/TR/xhtml-m12n-schema</dd>
</dl>

<!--OddPage-->
<h1><a id="s_acks" name="s_acks">E.Acknowledgments</a></h1>

<p><em>This section is informative.</em></p>

<p>This document was originally edited by Ted Wugofski (Openwave).</p>

<p>Special acknowledgments to: Mark Baker (Sun Microsystems), Wayne Carr (Intel Corporation), Warner ten Kate (Philips Electronics), Patrick Schmitz, and Peter Stark (Ericsson) for their significant
contributions to the evolution of this specification.</p>

<p>At the time of publication, the participants in the W3C HTML Working Group were:</p>

<ul class="acks">
<li>Steven Pemberton, <abbr>CWI</abbr>/<abbr>W3C</abbr> (HTML Working Group Chair)</li>

<li>Daniel Austin, W. W. Grainger, <abbr>Inc.</abbr></li>

<li>Jim Bigelow, Hewlett-Packard Company</li>

<li>Mark Birbeck, x-port.net <abbr title="Limited">Ltd.</abbr> (Invited Expert)</li>

<li>Jonny Axelsson, Opera Software</li>

<li>Tantek &#199;elik, Microsoft Corporation</li>

<li>Beth Epperson, Netscape/<abbr title="America Online">AOL</abbr></li>

<li>Masayasu Ishikawa, <abbr>W3C</abbr> (Team Contact)</li>

<li>Shin'ichi Matsui, Panasonic</li>

<li>Shane McCarron, Applied Testing and Technology (Invited Expert)</li>

<li>Ann Navarro, WebGeek, <abbr>Inc.</abbr> (Invited Expert)</li>

<li>Subramanian Peruvemba, Oracle Corporation</li>

<li>Sebastian Schnitzenbaumer, SAP <abbr lang="de" xml:lang="de" title="Aktiengesellschaft">AG</abbr></li>
</ul>
</body>
</html>

      
Properties
5b2baf5fbdead93c2728c3a90e3fbc32 01d6079ad71a7eeaae306da7cee24c37
base_uri@:http://www.w3.org/TR/2007/WD-xml-events-20070216/
base_uri@:http://www.w3.org/MarkUp/2007/ED-xml-events-20071114/Overview.html
charset@:utf-8
charset@:utf-8"
content_type@:text/html
label@en:XML Events 2 (2007-02-16 WD)
last_modified@:2007-02-15 22:01:09Z
derived_from@:digest:5b2baf5fbdead93c2728c3a90e3fbc32
label@en:XML Events 2 (2007-11-14 ED)
last_modified@:2007-11-14 17:09:48Z
title@en:XML Events 2
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:49:47Z
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:50:09Z
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:50:29Z
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:51:05Z
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:51:31Z
uri@:http://suika.fam.cx/gate/2007/schema/schema/5b2baf5fbdead93c2728c3a90e3fbc32/cache.dat<>2007-11-14 23:52:15Z
uri@:http://www.w3.org/TR/2007/WD-xml-events-20070216/<>2007-11-14 23:47:36Z
uri@:http://www.w3.org/MarkUp/2007/ED-xml-events-20071114/<>2007-11-14 23:43:59Z
uri@:http://www.w3.org/MarkUp/2007/ED-xml-events-20071114/<>2007-11-14 23:46:06Z
uri@:http://www.w3.org/MarkUp/2007/ED-xml-events-20071114/<>2007-11-14 23:46:47Z
uri@:http://www.w3.org/MarkUp/2007/ED-xml-events-20071114/<>2007-11-14 23:47:10Z
Edit Edit