<?xml version="1.0" encoding="ASCII"?><?xml-stylesheet type="text/xsl" href="../../../mathml/pmathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xml:space="preserve">
   <head>
      <meta http-equiv="Content-Type" content="text/html; utf-8"/>
      <title>Proceedings of Extreme Markup Languages&#174;</title>
      <link rel="stylesheet" href="../../../extreme-proceedings.css" type="text/css"/>
   </head>
   <body>
      <div id="head">
         <div class="inner">
            <img class="right" src="../../../icons/ExtremeNoDates.jpg"/>
            <h2>
               <i>Proceedings of Extreme Markup Languages<sup>&#174;</sup>
               </i>
            </h2>
         </div>
      </div>
      <div id="nav">
         <table width="100%" cellspacing="5">
            <tr height="29">
               <td class="button" width="20%" align="center">
                  <a title="Master Bibliography" href="../../../biblio.html">Master Bibliography</a>
               </td>
               <td class="button" width="20%" align="center">
                  <a title="Author Index" href="../../../authors.html">Author Index</a>
               </td>
               <td class="button" width="20%" align="center">
                  <a title="Topic Index" href="../../../topics.html">Topic Index</a>
               </td>
               <td class="button" width="20%" align="center">
                  <a title="Date Index" href="../../../dates.html">Date Index</a>
               </td>
               <td class="button" width="20%" align="center">
                  <a title="Proceedings Home" href="../../../index.html">Proceedings Home</a>
               </td>
            </tr>
         </table>
      </div>
      <div id="left1">
         <div class="inner">
            <h4>Streaming Validation of Schemata: the Lazy Typing Discipline</h4>
            <address>Paolo Marinelli <br class="br"/>
               <a href="mailto:pmarinel@cs.unibo.it" class="mailto">pmarinel@cs.unibo.it</a>
            </address>
            <address>Fabio Vitali <br class="br"/>
               <a href="mailto:fabio@cs.unibo.it" class="mailto">fabio@cs.unibo.it</a>
            </address>
            <address>Stefano Zacchiroli <br class="br"/>
               <a href="mailto:zacchiro@cs.unibo.it" class="mailto">zacchiro@cs.unibo.it</a>
            </address>
            <div class="abstract">
               <h4>Abstract</h4>
               <p class="first">Assertions, identity constraints, and conditional type assignments
			are (planned) features of XML Schema which rely on XPath
			evaluation to various ends. The allowed XPath subset exploitable in
			those features is trimmed down for streamability concerns partly
			understandable (the apparent wish to avoid buffering to determine the
			evaluation of an expression) and partly artificial.
		 </p>
               <p>
			In this paper we dissect the XPath language in subsets with varying
			streamability characteristics. We also identify the larger subset which
			is compatible with the typing discipline we believe underlies some of the
			choices currently present in the XML Schema specifications. We describe
			such a discipline as imposing that the type of an element has to be
			decided when its start tag is encountered and its validity has to be when
			its end tag is.
		 </p>
               <p>
			We also propose an alternative <i>lazy</i>
			typing discipline where both type assignment and validity assessment are
			fired as soon as they are available in a best effort manner. We believe
			our discipline is more flexible and delegate to schema authors the choice
			of where to place in the trade-off between using larger XPath subsets
			and increasing buffering requirements or expeditiousness of typing
			information availability.
		 </p>
            </div>
            <p class="keywords">
               <b style="font-size:85%">Keywords:</b> 
               <a href="../../../topics/XSD-W3CSchema.html">XSD/W3C Schema</a>; <a href="../../../topics/Validating.html">Validating</a>
            </p>
            <div class="contents">
               <h4>Table of Contents</h4>
               <dl>
                  <dt>
                     <a href="#sec-intro">Introduction</a>
                  </dt>
                  <dl>
                     <dt>
                        <a href="#t1-1">Paper Structure</a>
                     </dt>
                  </dl>
                  <dt>
                     <a href="#sec-xpath-stratification">Streaming XPath: a Stratification</a>
                  </dt>
                  <dl>
                     <dt>
                        <a href="#sec-sax-parser">The Evaluator API</a>
                     </dt>
                     <dt>
                        <a href="#sec-booleans-on-attributes">Boolean Expressions over Attributes (1,2)</a>
                     </dt>
                     <dt>
                        <a href="#sec-simple-function-on-attributes">Simple Functions over Attributes (2,2)</a>
                     </dt>
                     <dt>
                        <a href="#sec-complex-functions-on-attributes">Complex Functions over Attributes (5,2)</a>
                     </dt>
                     <dt>
                        <a href="#sec-booleans-on-dowards">Boolean Expressions over Downward Paths (1,3)</a>
                     </dt>
                     <dt>
                        <a href="#sec-simple-functions-on-downwards">Simple Functions over Downward Paths (2,3)</a>
                     </dt>
                     <dt>
                        <a href="#sec-tail-predicates-on-downwards">Tail Predicates over Downward Paths (3,3)</a>
                     </dt>
                     <dt>
                        <a href="#sec-inner-predicates-on-downwards">Inner Predicates over Downward Paths (4,3)</a>
                     </dt>
                     <dt>
                        <a href="#sec-complex-functions-on-downwards">Complex Functions over Downward Paths (5,3)</a>
                     </dt>
                     <dt>
                        <a href="#sec-booleans-on-forwards">Boolean Expressions over Forward Paths (1,4)</a>
                     </dt>
                     <dt>
                        <a href="#sec-simple-functions-on-forwards">Simple Functions over Forward Paths (2,4)</a>
                     </dt>
                     <dt>
                        <a href="#sec-tail-and-inner-predicates-on-forwards">Tail and Inner Predicate over Forward Paths (4,4)</a>
                     </dt>
                     <dt>
                        <a href="#sec-booleans-and-simple-functions-on-absolute-paths">Booleans Expressions over Forward Absolute Location Paths (1,5)</a>
                     </dt>
                     <dt>
                        <a href="#sec-tail-inner-predicates-over-absolute-paths">Tail and Inner Predicates over Forward Absolute Location Paths (4,5)</a>
                     </dt>
                     <dt>
                        <a href="#sec-booleans-over-backwards">Boolean Expressions over Backward Paths (1,1)</a>
                     </dt>
                     <dt>
                        <a href="#sec-simple-functions-on-backwards">Simple Functions over Backward Paths (2,1)</a>
                     </dt>
                     <dt>
                        <a href="#sec-xpath-functions">XPath Functions</a>
                     </dt>
                     <dl>
                        <dt>
                           <a href="#sec-simple-functions">Simple Functions</a>
                        </dt>
                        <dt>
                           <a href="#sec-complex-functions">Complex Functions</a>
                        </dt>
                     </dl>
                     <dt>
                        <a href="#sec-rewriting-algo">The Rewriting Algorithm</a>
                     </dt>
                  </dl>
                  <dt>
                     <a href="#sec-latvia">The LATVIA Typing Discipline</a>
                  </dt>
                  <dt>
                     <a href="#sec-implementation">Implementation</a>
                  </dt>
                  <dl>
                     <dt>
                        <a href="#sec-our-xpath-evaluator">Our Streaming XPath Evaluator</a>
                     </dt>
                     <dl>
                        <dt>
                           <a href="#sec-xaos-dsc">A Gentle Introduction to &#967;&#945;o&#962;</a>
                        </dt>
                        <dt>
                           <a href="#t4-1-2">Absolute Location Paths in Predicates</a>
                        </dt>
                        <dt>
                           <a href="#t4-1-3">The Use of DFAs</a>
                        </dt>
                        <dt>
                           <a href="#t4-1-4">Operators and Functions</a>
                        </dt>
                        <dt>
                           <a href="#t4-1-5">Total Matching and Propagation</a>
                        </dt>
                        <dt>
                           <a href="#sec-xpath-impl-evaluation-outcome">Evaluation Outcome</a>
                        </dt>
                        <dt>
                           <a href="#t4-1-7">Evaluation Example</a>
                        </dt>
                     </dl>
                     <dt>
                        <a href="#sec-latvia-model-implementation">The LATVIA Model Implementation</a>
                     </dt>
                     <dt>
                        <a href="#sec-code">Working Prototype</a>
                     </dt>
                     <dt>
                        <a href="#sec-related-work">Related Works</a>
                     </dt>
                  </dl>
               </dl>
            </div>
            <div class="authorBio">
               <h4>Paolo Marinelli</h4>
               <p class="first">Paolo Marinelli holds a Master Degree in Computer Science at the University of
					Bologna. The topic of his Master Thesis regards SchemaPath, the conservative
					extension of XML Schema for expressing conditional content models and
					co-constraints, partially described in this paper.</p>
            </div>
            <div class="authorBio">
               <h4>Fabio Vitali</h4>
               <p class="first">Fabio Vitali is an associate professor at the Department of Computer Science
					at the University of Bologna. He holds a Laurea degree in Mathematics and a
					Ph.D. in Computer and Law, both from the University of Bologna. His research
					interests include markup languages; distributed, coordinated systems; and the
					World Wide Web. He is the author of several papers on hypertext functionalities,
					the World Wide Web, and XML.</p>
            </div>
            <div class="authorBio">
               <h4>Stefano Zacchiroli</h4>
               <p class="first">Stefano Zacchiroli is a PhD candidate in Computer Science at the University of
					Bologna. His thesis, titled <i>User Interaction Widgets for
						Interactive Theorem Proving</i>, sits at the intersection of the
					type theory and human computer interaction fields. His research interests also
					encompass markup languages and in particular co-constraints and overlapping
					markup for XML-based languages.</p>
            </div>
         </div>
      </div>
      <div id="paperLinks">
         <table width="100%" cellspacing="5">
            <tr height="18">
               <td class="button" width="25%" align="center">
                  <a title="XML Source" href="../../../xml/2007/Marinelli01/EML2007Marinelli01.xml">XML&#160;Source</a>
               </td>
               <td class="button" width="25%" align="center">
                  <a title="PDF Version" href="../../../xslfo-pdf/2007/Marinelli01/EML2007Marinelli01.pdf">PDF&#160;(for&#160;print)</a>
               </td>
               <td class="button" width="25%" align="center">
                  <a title="Author Package" href="../../../author-pkg/2007/Marinelli01/EML2007Marinelli01.zip">Author&#160;Package</a>
               </td>
               <td class="nobutton" width="25%" align="center">
                  <span class="nolink">Typeset&#160;PDF</span>
               </td>
            </tr>
         </table>
      </div>
      <div id="right1">
         <div class="inner">
            <div class="front">
               <h1 class="title">Streaming Validation of Schemata: the Lazy Typing Discipline</h1>
               <address>Paolo Marinelli [University of Bologna, Department of Computer Science]</address>
               <address>Fabio Vitali [University of Bologna, Department of Computer Science]</address>
               <address>Stefano Zacchiroli [University of Bologna, Department of Computer Science]</address>
               <h3 class="conference">Extreme Markup Languages 2007&#174; (Montr&#233;al, Qu&#233;bec)</h3>
               <h4>
                  <i>Copyright &#169; 2007 Paolo Marinelli, Fabio Vitali, and Stefano Zacchiroli. Reproduced with permission.</i>
               </h4>
            </div>
            <div class="mathml-warning">
               <p>
                  <i>
                     <b>Note:</b>
                  </i> This paper contains <a href="http://www.w3.org/Math/">W3C MathML</a>,
          which is not equally well supported in all browsers. If you have reason to think 
          that mathematical expressions are not displaying properly, consult the 
          <a href="../../../xslfo-pdf/2007/Marinelli01/EML2007Marinelli01.pdf">PDF version</a> (or try a different browser).</p>
            </div>
            <div class="section">
               <h2>
                  <a name="sec-intro"/>Introduction</h2>
               <p>At the end of August 2006, a new draft of the upcoming 1.1 release of
			 <i>XML Schema: Structures</i>
				has been published by the W3C <b>
                     <span style="font-size:85%">
                        <a href="#xmlschema-draft" name="fromxmlschema-draft">[XMLSchema]</a>
                     </span>
                  </b>. Among
				the major changes from the previous specifications we found the new concept of
				<i>assertions</i> (see Figure <a href="#fig-example-assertion">1</a>), one of the possible ways to
				express co-constraints <b>
                     <span style="font-size:85%">
                        <a href="#co-constraints-esw-wiki" name="fromco-constraints-esw-wiki">[CoConstrWiki]</a>
                     </span>
                  </b> in XML Schema schemata.
				Both identity constraints (see Figure <a href="#fig-example-idref">2</a>),
				which were already present in former versions of the XML Schema
				specifications, and assertions exploit XPath<sup>
                     <span class="highlight">
                        <a href="#tod0e116" name="fromd0e116">1</a>
                     </span>
                  </sup> expressions <b>
                     <span style="font-size:85%">
                        <a href="#xpathspec20" name="fromxpathspec20">[XPath2]</a>
                     </span>
                  </b> to point to
				the elements and attributes that are relevant in the validity assessment of the
				elements they control. A further approach to co-constraints, CTA [Conditional Type Assignment], is being
				discussed at this moment for inclusion in subsequent drafts of XML Schema 1.1, and
				also heavily relies on XPath expressions to specify the elements and
				attributes that are relevant for the conditional assignment of type to the element
				or attribute being defined.</p>
               <div class="figure">
                  <a name="fig-example-assertion"/>
                  <h5>Figure 1: Assertion example</h5>
                  <pre>&lt;xs:complexType name="T"&gt;
 &lt;xs:attribute name="a" type="xs:string" /&gt;
 &lt;xs:attribute name="b" type="xs:string" /&gt;
 <b>&lt;xs:report test="@a and @b" /&gt;
 &lt;xs:assert test="@a or @b" /&gt;</b>
&lt;/xs:complexType&gt;</pre>
                  <div style="font-size:85%">
                     <p class="first">Two assertions about the attributes <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll"> 
                              <mml:mi mathvariant="monospace">a</mml:mi> 
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll"> 
                              <mml:mi mathvariant="monospace">b</mml:mi> 
                           </mml:math>
                        </span> are
			given: the former reports an error if both are present (i.e. <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll"> 
                              <mml:mi mathvariant="monospace">a</mml:mi> 
                           </mml:math>
                        </span> and
			<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll"> 
                              <mml:mi mathvariant="monospace">b</mml:mi> 
                           </mml:math>
                        </span> are mutually exclusive), the latter to impose that at least one
			among them is present.</p>
                  </div>
               </div>
               <div class="figure">
                  <a name="fig-example-idref"/>
                  <h5>Figure 2: Identity constraint definition example</h5>
                  <pre>&lt;xs:element name="state"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:sequence maxOccurs="unbounded"&gt;
   &lt;xs:element name="province"&gt;
    &lt;xs:complexType&gt;
     &lt;xs:attribute name="code" type="xs:string" /&gt;
    &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;xs:attribute name="code" type="xs:string" /&gt;
 &lt;/xs:complexType&gt;
 <b>&lt;xs:key name="provinceKey"&gt;
  &lt;xs:selector xpath="./province" /&gt;
  &lt;xs:field xpath="@code" /&gt;
 &lt;/xs:key&gt;
</b>&lt;/xs:element&gt;</pre>
                  <div style="font-size:85%">
                     <p class="first">Enforcing that a province code is a key indexing the
			provinces of a state</p>
                  </div>
               </div>
               <p>Both identity constraints and assertions do not specify that the full syntax of
				XPath 2.0 can be used, but only limited subsets of it. In particular, they
				both exclude a large number of functions and operators, and many axes. The reason
				behind these restrictions is fundamentally the need to allow the implementation of
				streaming XML parsers that validate documents with respect to XML Schema schemata, as
				explained in the draft itself.</p>
               <p>A streaming XML parser is a parser that accesses and verifies XML documents in a
				serial way, i.e. as a single, unidirectional data stream whereby previously accessed
				data are not meant to be re-read for new information. Streaming parsers generate
				events (e.g. <i>startElement</i> or <i>endElement</i>) for downstream applications
				upon encountering relevant XML structures in the incoming stream and never generate
				a full memory representation of the document. SAX <b>
                     <span style="font-size:85%">
                        <a href="#sax" name="fromsax">[Sax]</a>
                     </span>
                  </b> is a
				well-known API between streaming parsers and downstream applications that
				standardizes the events signaling the reading of noteworthy XML structures in the
				source stream. Streaming parsers are extremely fast and require a much smaller
				memory footprint than with other tree-based parsing approaches like DOM <b>
                     <span style="font-size:85%">
                        <a href="#dom" name="fromdom">[Dom]</a>
                     </span>
                  </b>.</p>
               <p>Validating streaming parsers are able to assess the validity of elements and
				attributes while reading them in the source stream, and are designed to be able to
				do so as soon as possible, with a minimal amount of memory, and without the need to
				look ahead or behind in the incoming stream. One such parser is Xerces <b>
                     <span style="font-size:85%">
                        <a href="#xerces2" name="fromxerces2">[Xerces2]</a>
                     </span>
                  </b>, the XML parser of the Apache project.</p>
               <p>XPath expressions do not in general allow streaming implementations. In
				fact, XPath expressions associated to a specific XML context node can freely
				span to structures before or after the context node itself, which requires
				continuous and complete access to the full document tree for evaluation. Therefore,
				the subset of XPath included in the current draft of XML Schema contains only
				those constructs that are considered to behave safely in a streaming environment,
				for instance because they can be guaranteed to end their evaluation in a reasonable
				amount of time and using a reasonable amount of memory. </p>
               <p>This paper makes two important claims, as well as a few minor ones. First of all,
				it claims that the subset of XPath constructs included in the XML Schema draft
				is even more restrictive than necessary for naive streaming implementations of
				XML Schema engines.<sup>
                     <span class="highlight">
                        <a href="#tod0e198" name="fromd0e198">2</a>
                     </span>
                  </sup>
				Second, it proposes a different validation concept that would
				further widen the allowable subset of XPath expressions and would allow
				implementation to tune finely the allowed subset to the memory and time requirements
				of the validation engine.</p>
               <p>In order to prove these points, we have first analyzed the time and memory
				requirements of each structure of XPath 2.0, and have organized them in several
				classes whose stratification and characteristics are explained in Section
				<a href="#sec-xpath-stratification">2</a>.</p>
               <p>Next we consider the validation model that is implicit in current
				implementations of streaming XML Schema engines. The validation of XML documents
				against an XML Schema has two very specific actions: first, a type is chosen for the
				element (or attribute), and next its content is evaluated against the content model
				specified in the type, in order to determine its validity. </p>
               <p>The current rule of thumb for the evaluation of what is acceptable for streaming
				validation is what we call the STEVE [Start tag: Type; End tag: Validity Evaluation] discipline. STEVE imposes that the
				type is determined as soon as the element name is read from the input stream (or,
				with generous flexibility, at the end of the start tag that contains the name
				itself), and that the validity is determined as soon as the content of the element
				has been completely examined, i.e., at the end of the element itself, when reading
				its end tag. </p>
               <p>Thus, in STEVE the relevant XPath expressions cannot point to
				structures before the start tag (because only at its occurrence we know that they
				are needed), and they also cannot point to structures after the end tag, since the
				validity needs to be assessed at the end tag of the element. As such, the only
				remaining XPath subset is whatever points downward, i.e. along the
				"attribute", "child", and "descendant" axes. </p>
               <p>The STEVE discipline is even more harmful for CTA as introduced with
				SchemaPath <b>
                     <span style="font-size:85%">
                        <a href="#schemapathWWW04" name="fromschemapathWWW04">[Marinelli04]</a>
                     </span>
                  </b>. In CTA, the typing of an
				element is conditional to a set of XPath expressions, so that the same element
				can be typed in a way or another depending on their truth values
				(see Figure <a href="#fig-example-cta">3</a>). Therefore,
				according to STEVE, typing must both start <i>and</i> end when reading the start tag of the element. Thus, the only
				remaining XPath axis for CTA is "attribute". This means that if
				XML Schema were to adopt CTA, the STEVE discipline would allow types only
				to depend on the values of the attributes of an element or a comparison between
				different attributes of the same element.</p>
               <div class="figure">
                  <a name="fig-example-cta"/>
                  <h5>Figure 3: Conditional declaration example</h5>
                  <pre>&lt;xs:element name="x" type="T"&gt;
 <b>&lt;xs:alt cond="@a='foo'" type="Ta" /&gt;
 &lt;xs:alt cond="@a='bar'" type="Tb" /&gt;</b>
&lt;/xs:element&gt;</pre>
                  <div style="font-size:85%">
                     <p class="first"> An element validated against this declaration is assigned
			type <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">Ta</mml:mi>
                           </mml:math>
                        </span> if it has an attribute <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">a</mml:mi>
                           </mml:math>
                        </span> with value <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">"foo"</mml:mi>
                           </mml:math>
                        </span>,
			<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">Tb</mml:mi>
                           </mml:math>
                        </span> if <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">a</mml:mi>
                           </mml:math>
                        </span> has value <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">"bar"</mml:mi>
                           </mml:math>
                        </span>, type <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">T</mml:mi>
                           </mml:math>
                        </span> otherwise. </p>
                  </div>
               </div>
               <p>Yet, the usefulness of co-constraints (both in terms of assertions and, even more
				so, of conditional type assignments) can be easily determined if we consider the
				number of co-constraints that are currently expressed informally as plain text in
				appendices or comments of the fully formal schemata describing and detailing XML
				vocabularies. Examples from XHTML [Extensible HyperText Markup Language] <b>
                     <span style="font-size:85%">
                        <a href="#xhtmlspec" name="fromxhtmlspec">[XHTML]</a>
                     </span>
                  </b>,
				XSLT [XSL Transformations] <b>
                     <span style="font-size:85%">
                        <a href="#xsltspec" name="fromxsltspec">[XSLT]</a>
                     </span>
                  </b> , UBL [Universal Business Language] <b>
                     <span style="font-size:85%">
                        <a href="#ublspec" name="fromublspec">[UBL]</a>
                     </span>
                  </b>, FpML [Financial products Markup Language] <b>
                     <span style="font-size:85%">
                        <a href="#fpmlspec" name="fromfpmlspec">[FpML]</a>
                     </span>
                  </b>,
				XML Schema itself <b>
                     <span style="font-size:85%">
                        <a href="#xmlschema-draft" name="fromxmlschema-draft">[XMLSchema]</a>
                     </span>
                  </b>,
				and hundreds of other specialized vocabularies exist to prove this point.
				</p>
               <p>This leads us to discuss some considerations (including
			 forward-looking rewriting of backward-looking XPath expressions as first
			 introduced by <b>
                     <span style="font-size:85%">
                        <a href="#omfb2002" name="fromomfb2002">[Olteanu02]</a>
                     </span>
                  </b>) about Full STEVE XPath, the widest
			 allowable subset of XPath structures to be fruitfully evaluated in a
			 STEVE-controlled streaming environment. In this paper we present a
			 syntactic approximation of Full STEVE XPath which we believe is easily
			 understandable for XML Schema users.
			</p>
               <p>Next, we propose a new streaming evaluation discipline for XML Schema, which we call
				LATVIA [Lazy Assignment of Typing and Validity Infoset Aspects] that extends STEVE by allowing both typing and validity events
				to happen at any moment during the streaming processing of the input document, thus
				allowing the relevant elements and attributes to be anywhere in the document, and
				therefore the corresponding expressions to contain arbitrary XPath constructs.</p>
               <p>A LATVIA-driven streaming environment would identify in advance all relative
				XPath expressions, converting them to forward-looking absolute expressions, and constantly verify
				their truth values throughout the parsing of the document. Whenever an element
				controlled by one such expression is found, an independent evaluator is detached and
				associated to the element, which returns a "Success" or "Failure" event as soon as
				the relevant elements and attributes are found in the document. If the original
				expression pointed upward or before the relevant element, it would have already succeeded
				or failed when meeting the element, and no further evaluation would be necessary. If the
				original expression pointed downward, then it either would succeed or fail before or at
				the end of the element, and the evaluation would stop in time for the end of the element.
				If the original expression pointed to structures after the end of the element, then
				the relevant expression could not be conclusively evaluated at that time, and its
				validity and type would remain in an undecided state up to the moment in
				which the relevant element would be read and evaluated.</p>
               <p>LATVIA thus is adding a new possible state for the type and validity properties
				of an XML element (the value "not decided yet") and does not
				necessarily considers the typing at the start of the element
				and the validation at the end of the element as strict and final assertions,
				but rather as lazy assertions that may need to be verified and confirmed later on, when
				the appropriate document structures are found and verified.</p>
               <p>We believe that LATVIA is the best possible approach to perform streaming validation in the presence
				of arbitrary co-constraints using assertions and conditional type assignments. We believe
				no alternative approach can provide a solution with lesser requirements in terms of memory occupation
				and expeditiousness in determining invalidity given the same subset of XPath supported.</p>
               <div class="subsec1">
                  <h3>
                     <a name="t1-1"/>Paper Structure</h3>
                  <p>The paper is structured as follows. In Section <a href="#sec-xpath-stratification">2</a> we provide
				 the classification of XPath expressions. In Section <a href="#sec-latvia">3</a> we introduce
				 the LATVIA model. In Section <a href="#sec-implementation">4</a> we describe our
				 implementation of a streaming XML Schema validator supporting CTA and following the
				 LATVIA discipline. In particular, our implementation is also able to evaluate the
				 conditions used within conditional declarations. Thus, in Section <a href="#sec-implementation">4</a>
				 we also describe our implementation of a streaming XPath evaluator.
				 
				</p>
               </div>
            </div>
            <div class="section">
               <h2>
                  <a name="sec-xpath-stratification"/>Streaming XPath: a Stratification</h2>
               <p>In this section we describe several classes of XPath expressions.
			 For each class we discuss streamability issues, namely: memory
			 requirements and the amount of time that should be waited for to know
			 the evaluation result.  Memory requirements are measured on some metrics
			 of the input document (e.g. the number of nodes, document depth,
			 etc).</p>
               <p>Our interest on XPath streamability derives from a more general interest on the
			streamability of XML Schema 1.1. In XML Schema schemata, XPath is always used within a
			<i>relative</i> context, i.e.:
			<ul>
                     <li>assertions are evaluated relatively to the element nodes assigned to the schema types
					which they are defined in;</li>
                     <li>identity-constraints are evaluated relatively to the nodes matching the
					element declarations which they are defined in;</li>
                     <li>CTA conditions are evaluated relatively to the nodes matching the conditional declaration
					which they are defined in.</li>
                  </ul>
			Therefore it is natural to perform our stratification on the expressions
			that can be used within a location step predicate.</p>
               <p>For each class we are going to consider, the complexity in the
			 evaluation of its expressions is dominated by the <i>axes</i> allowed within location path
			 sub-expressions, the <i>kind of
				predicates</i> allowed within their steps, and the set of
			 allowed <i>functions</i>.</p>
               <p>We will partition functions into two classes: <i>simple</i> and <i>complex</i> functions. The former class contains
			 functions whose evaluation requires an amount of memory at most linear
			 in the amount of memory required by the evaluation of its arguments; the
			 latter functions whose evaluation requires to buffer nodes of the input
			 document regardless of the memory required to evaluate its arguments. At
			 the end of the section we will provide the list of complex
			 functions.</p>
               <p>Moreover, we operate a distinction also on simple functions. Indeed, we distinguish
			among boolean operators (which are simple functions) and the other simple functions. Such
			a distinctions will be useful when we will discuss about the evaluation of reverse paths. </p>
               <p>Finally, we also distinguish among tail and inner predicates.
			We define a <i>tail predicate</i> as a predicate appearing within
			the predicate list of the last step of a location path. We call the other predicates
			<i>inner predicates</i>.</p>
               <p>The main claim of this section is grasped by the following table
			(referenced as the <i>stratification
			 table</i> in the remainder of the paper).</p>
               <div class="table">
                  <h5>Table 1: XPath stratification. Each column selects a different set of
				 axes, while each row identifies a different XPath feature. Within
				 each cell, <i>startElement</i>, <i>endElement</i>, and <i>endDocument</i> indicate
				 when the evaluation result is available w.r.t the context node;
				 "constant", "linear-depth", and "linear-size" indicate if the amount of required
				 memory is respectively constant, linear in the document depth, linear
				 in the document size. Side numbers are used in the remainder of the
				 paper for referencing this table cells.</h5>
                  <table summary="XPath stratification. Each column selects a different set of&#xA;&#x9;&#x9;&#x9;&#x9; axes, while each row identifies a different XPath feature. Within&#xA;&#x9;&#x9;&#x9;&#x9; each cell, startElement, endElement, and endDocument indicate&#xA;&#x9;&#x9;&#x9;&#x9; when the evaluation result is available w.r.t the context node;&#xA;&#x9;&#x9;&#x9;&#x9; &#34;constant&#34;, &#34;linear-depth&#34;, and &#34;linear-size&#34; indicate if the amount of required&#xA;&#x9;&#x9;&#x9;&#x9; memory is respectively constant, linear in the document depth, linear&#xA;&#x9;&#x9;&#x9;&#x9; in the document size. Side numbers are used in the remainder of the&#xA;&#x9;&#x9;&#x9;&#x9; paper for referencing this table cells." border="1" width="85%">
                     <colgroup>
                        <col/>
                        <col/>
                        <col/>
                        <col/>
                        <col/>
                        <col/>
                     </colgroup>
                     <tbody>
						

                        <tr>
                           <td>&#160;</td>
                           <td>
                              <b>Backward Axes</b>
                           </td>
                           <td>
                              <b>"attribute" Axis</b>
                           </td>
                           <td>
                              <b>Downward Axes</b>
                           </td>
                           <td>
                              <b>Forward Axes</b>
                           </td>
                           <td>
                              <b>Absolute Paths</b>
                           </td>
                           <td>&#160;</td>
                        </tr>
						

                        <tr>
                           <td>
                              <b>Boolean ops</b>
                           </td>
                           <td>
                              <i>startElement</i>, linear-depth</td>
                           <td>
                              <i>startElement</i>, constant</td>
                           <td>
                              <i>endElement</i>, linear-depth </td>
                           <td>
                              <i>endDocument</i>, linear-depth</td>
                           <td>
                              <i>endDocument</i>, linear-depth</td>
                           <td>1</td>
                        </tr>
						

                        <tr>
                           <td>
                              <b>Simple Functions</b>
                           </td>
                           <td>
                              <i>startElement</i>, linear-size</td>
                           <td>
                              <i>startElement</i>, constant</td>
                           <td>
                              <i>endElement</i>, linear-depth</td>
                           <td>
                              <i>endDocument</i>, linear-depth</td>
                           <td>
                              <i>endDocument</i>, linear-depth</td>
                           <td>2</td>
                        </tr>
						

                        <tr>
                           <td>
                              <b>Tail Predicates</b>
                           </td>
                           <td>
                              <i>startElement</i>, linear-depth</td>
                           <td>N/A<sup>
                                 <span class="highlight">
                                    <a href="#tod0e543" name="fromd0e543">3</a>
                                 </span>
                              </sup>
                           </td>
                           <td>
                              <i>endElement</i>, linear-depth</td>
                           <td>
                              <i>endDocument</i>, linear-size</td>
                           <td>
                              <i>endDocument</i>, linear-depth</td>
                           <td>3</td>
                        </tr>
						

                        <tr>
                           <td>
                              <b>Inner Predicates</b>
                           </td>
                           <td>
                              <i>startElement</i>, linear-depth</td>
                           <td>N/A<sup>
                                 <span class="highlight">
                                    <a href="#tod0e543">3</a>
                                 </span>
                              </sup>
                           </td>
                           <td>
                              <i>endElement</i>, linear-size</td>
                           <td>
                              <i>endDocument</i>, linear-size</td>
                           <td>
                              <i>endDocument</i>, linear-size</td>
                           <td>4</td>
                        </tr>
						

                        <tr>
                           <td>
                              <b>Complex Functions</b>
                           </td>
                           <td>
                              <i>startElement</i>, linear-size</td>
                           <td>
                              <i>startElement</i>, linear-size</td>
                           <td>
                              <i>endElement</i>, linear-size</td>
                           <td>
                              <i>endDocument</i>, linear-size</td>
                           <td>
                              <i>endDocument</i>, linear-size</td>
                           <td>5</td>
                        </tr>
					 

                        <tr>
                           <td>&#160;</td>
                           <td>1</td>
                           <td>2</td>
                           <td>3</td>
                           <td>4</td>
                           <td>5</td>
                           <td>&#160;</td>
                        </tr>
					
                     </tbody>
                  </table>
               </div>
               <p>We identify the Full STEVE XPath subset <i>approximation</i> as the union of the XPath
			 subsets contained in the first two columns of the stratification table. A
			 precise, formal definition of Full STEVE XPath should take into account not only
			 syntactic aspects (as those we are mainly concerned with in this paper)
			 but also semantic ones. A precise semantic definition of Full STEVE XPath should be
			 given in term of which nodes are touched by the evaluation of a given
			 XPath expression: if and only if all of them fall before the context
			 node the expression is part of Full STEVE XPath. Otherwise stated, it should be
			 possible to <i>complete</i> the evaluation
			 of a Full STEVE XPath expression before the start tag of the context node is
			 encountered. To grasp this idea consider the expression
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
				 
                        <mml:mtext>./preceding::x/descendant::y/following-sibling::z</mml:mtext>
				
                     </mml:math>
                  </span>
			 which escapes from our approximation. Still, its evaluation finishes
			 before the context node and hence it is arguable that such an expression
			 should be part of a precise Full STEVE XPath definition. However a trade-off
			 between precise definition and understandability of the constraint by
			 XML Schema authors should be considered: we believe our choice (choosing a
			 syntactic constraint instead of a more involved semantic one) to be
			 reasonable.</p>
               <p>Other works such as <b>
                     <span style="font-size:85%">
                        <a href="#xpath-memory-requirements" name="fromxpath-memory-requirements">[BarYossef04]</a>
                     </span>
                  </b>
			 and related works have studied formally the theoretical memory
			 requirements for the streaming evaluation of XPath expressions. We
			 compare to those works attempting a less formal (for the time being)
			 analysis yet more complete not restricting ourselves to artificially
			 small subset of the XPath language. Moreover, we also consider in our
			 analysis the moment after which the evaluation of the expression can be
			 considered completed (wrt a context node), scenario not analyzed in
			 previous works which were not particularly biased toward the use of
			 XPath in XML Schema.</p>
               <p>The remainder of this section explains the most interesting
			 placement choices, skipping the obvious ones. Each section title is
			 equipped with "(row, column)" reference to the cell of the table it
			 describes.</p>
               <div class="subsec1">
                  <h3>
                     <a name="sec-sax-parser"/>The Evaluator API</h3>
                  <p>For each class we define the issues to be faced in designing a
			generic streaming XPath evaluator. We assume that the evaluator works
			in the following setting (note how the input requirements can be easily
			fulfilled by any SAX-compliant parser):
			<ol type="1">
                        <li>task of the evaluator is to evaluate a single XPath
					 expression on a single streamed XML document;</li>
                        <li>the evaluator receives a sequence of input events describing
					 the logical structure of the document to evaluate. The input events
					 we are interested in are:
					<ul>
                              <li>
                                 <i>startDocument</i>: it signals the beginning of the document;</li>
                              <li>
                                 <i>endDocument</i>: it signals the end of the document, i.e.
							 the document does not contain further nodes;</li>
                              <li>
                                 <i>startElement</i>: it signals the start-tag of an element. We
							 assume the event has some parameters specifying: the element
							 name, a unique and progressive numeric identifier of the node
							 (increasing following the document order), a number
							 indicating the depth-level. Moreover, we assume this event is
							 also parameterized in the attribute list of the element.</li>
                              <li>
                                 <i>endElement</i> it signals the end-tag of an element. Except for the
							attribute list, the event has the same parameters of <i>startElement</i>.</li>
                              <li>
                                 <i>text</i>: it signals the presence of a text node. The
							 event is parameterized in a string specifying the text
							 content.</li>
                           </ul>
					
                        </li>
                        <li>the output of the evaluator depends on the semantics defined
					 for the expression to evaluate. If the output is an atomic value,
					 the output is an event specifying the result of the evaluation; if
					 the result of the evaluation is a node sequence, than the evaluator
					 produces a sequence of output events: an event for each node of the
					 sequence. Each event contains the numeric identifier of the selected
					 node. There is also an extra output event indicating the end of the
					 sequence.</li>
                     </ol>
			
                  </p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-booleans-on-attributes"/>Boolean Expressions over Attributes (1,2)</h3>
                  <p>In this section we consider the set of expressions built over
				 relative paths without predicates, where boolean operators (<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">and</mml:mi> 
                        </mml:math>
                     </span>,
				 <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">or</mml:mi> 
                        </mml:math>
                     </span>, and <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi mathvariant="monospace">not()</mml:mi>
                        </mml:math>
                     </span>) can be used and where the only allowed axis is
				 "attribute". An instance of such expressions is

<div class="codeblock">
                        <pre>(@a or @b) and @c</pre>
                     </div>
				Given a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, any expression of this subset can be easily evaluated
				processing the attribute list specified in the <i>startElement</i> event of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. Thus,
				the evaluation of such an expression starts at the <i>startElement</i> event
				of the context node and ends at the same event: it is not necessary to wait for
				further events, in order to decide the result.</p>
                  <p>It is easy to observe that the evaluation of such expressions requires a
				<i>constant</i> amount of memory.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-simple-function-on-attributes"/>Simple Functions over Attributes (2,2)</h3>
                  <p>Here we consider an XPath fragment extending the one defined
				in Section <a href="#sec-booleans-on-attributes">2-2</a>, allowing the usage of
				simple functions. An instance of this fragment is
				
<div class="codeblock">
                        <pre>(@a eq '8' or @b) and @c</pre>
                     </div>
                  </p>
                  <p>Again, given an expression of this fragment and given a
				context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, the evaluation of the expression has to start
				at the end <i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, and it ends by the
				same event. Indeed, it is sufficient to process the attribute list
				specified within the input event.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-complex-functions-on-attributes"/>Complex Functions over Attributes (5,2)</h3>
                  <p>In this section we consider the XPath fragment obtained from
				that defined in Section <a href="#sec-simple-function-on-attributes">2-3</a>, allowing the usage of
				complex functions. As the evaluation of a complex functions may require
				an amount of memory linear in the number of document nodes, the
				evaluation of an expression of this fragment may require the same
				amount of memory.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-booleans-on-dowards"/>Boolean Expressions over Downward Paths (1,3)</h3>
                  <p>In this section we consider an extension of the fragment described in
				Section <a href="#sec-booleans-on-attributes">2-2</a>. The extension is obtained
				allowing the use of relative paths with no predicates, and with the following set
				of allowed axes:
				<ul>
                        <li>"attribute"</li>
                        <li>"child"</li>
                        <li>"descendant"</li>
                     </ul>
				An expression belonging to this XPath fragment is
				
<div class="codeblock">
                        <pre>a//b or b/c</pre>
                     </div>
				
                  </p>
                  <p>Given a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, in order to evaluate an expression of this fragment,
				the <i>startElement</i> event of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> has to be reached. Moreover, each relative
				path can be evaluated using a simple stack whose elements maintain the node-test set
				that can be matched at the current depth level of the document. Each time the last
				node-test is matched by a node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span>, we can assert that <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> is selected by
				the path, and thus that the path is satisfied.</p>
                  <p>It can be observed that, as the allowed axes are just "attribute",
				"child" and "descendant", the nodes selected by the paths of the current XPath
				fragment are necessarily contained by the context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. As a consequence,
				if by the <i>endElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> no node has been selected by the path, a streaming
				evaluator can conclusively decides that the path does not select any node using
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> as context node.</p>
                  <p>As a consequence, the result of the evaluation of this XPath subset expressions
				is always available by the end-tag of the context node.</p>
                  <p>Moreover, the amount of memory required to evaluate these
				expressions is linear in the depth of the tree fragment rooted at the
				context node.  Such an amount of memory is the same required to decide
				the well-formedness of an XML document.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-simple-functions-on-downwards"/>Simple Functions over Downward Paths (2,3)</h3>
                  <p>In this section, we extend the XPath fragment considered in Section
				<a href="#sec-booleans-on-dowards">2-5</a>, allowing the use of simple functions.
				An expression belonging to this subset is
				
<div class="codeblock">
                        <pre>(count(.//a//b) = 5) and c</pre>
                     </div>
				
                  </p>
                  <p>As it can be observed in the above example, the use of simple functions may
				require location paths to evaluate to node sequences, rather than booleans. However,
				for the evaluation of these expressions, such a requirement does not imply the usage of
				an amount of memory greater than that used to evaluate the expressions of the previous
				fragment.</p>
                  <p>Moreover, by definition the evaluation of simple functions does not require
				an amount of memory greater than that required to evaluate its arguments. In the
				XPath fragment we are considering, the only expressions that needs to visit
				the input document in order to be evaluated are the location paths. As the evaluation
				of such expressions requires an amount of memory linear in the depth
				of the tree rooted at the context node, the evaluation of simple functions cannot
				require more memory.</p>
                  <p>Thus, the memory required to evaluate this XPath fragment
				expressions is linear in the depth of the tree rooted at the context
				node. The evaluation of any of these expressions terminates by the
				end-tag of the context node (given that the set of allowed axes are
				"attribute", "child" and "descendant").</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-tail-predicates-on-downwards"/>Tail Predicates over Downward Paths (3,3)</h3>
                  <p>In this section we consider the XPath fragment obtained from the
				previous one, allowing the use of <i>tail predicates</i>
				within relative paths.  An expression of this XPath fragment is
				
<div class="codeblock">
                        <pre>.//a/b//c[d or e]</pre>
                     </div> 
                  </p>
                  <p>The only features we have added w.r.t the previous XPath
				subset, is the usage of tail predicates. Thus we have to study their
				evaluation. Consider the example expression shown above. When a
				streaming evaluator receives the <i>startElement</i> of a node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> found
				to match the last step of the location path, it cannot decide if <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span>
				satisfies the predicate or not since the <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> children have not been
				visited yet. Thus, the evaluator cannot decide if <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> is selected by
				the main location path or not.</p>
                  <p>However, by the end-tag of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> all the children of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> have
				been visited, and thus it is possible to know if the predicate has been
				satisfied or not. Thus, at the end-tag of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> it is possible to
				decide if it is selected by the location path or not.</p>
                  <p>Note that, when the <i>startElement</i> event of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> is received, a
				streaming evaluator is not required to store it in memory, i.e. to
				<i>buffer</i> it.</p>
                  <p>Thus, also for this XPath fragment we can state that: all the
				expressions are conclusively evaluated by the end-tag of the context
				node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>; the memory amount required to evaluate these expressions
				is linear in the depth of the tree fragment rooted at the context
				node.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-inner-predicates-on-downwards"/>Inner Predicates over Downward Paths (4,3)</h3>
                  <p>We extend the  XPath fragment considered in
				Section <a href="#sec-tail-predicates-on-downwards">2-7</a>,
				adding <i>inner predicates</i>.
				An expression belonging to the current XPath fragment is
				
<div class="codeblock">
                        <pre>count(.[a]//*)</pre>
                     </div>
				
                  </p>
                  <p>Given a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, in order to evaluate an expression
				of this XPath fragment, a memory amount linear in the <i>number</i> of nodes contained by <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> might be
				required. Indeed, consider the example expression shown above and
				suppose that the context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> does <i>not</i> contain any <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> elements. In such a
				case, all the nodes contained by <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> have to be selected only if
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> has a child named <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span>. However, given a node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> contained
				by <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, neither by its <i>startElement</i> nor by its <i>endElement</i>
				events, it is possible to know if <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> is a node selected by the
				location path or not. Indeed, it is not yet possible to know if <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>
				has a child <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> or not.</p>
                  <p>As a consequence, it is necessary to buffer <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> until the
				end-tag of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> is reached. At that time, a streaming evaluator can
				assert that <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> is not selected by the location path. Such a
				buffering is clearly required for any node contained in the context
				node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>.</p>
                  <p>Finally, also for the current XPath fragment, in order to
				evaluate an expression it is necessary to visit the nodes contained by
				the context node: the evaluation process starts at the start-tag of the
				context node and terminates by its end-tag.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-complex-functions-on-downwards"/>Complex Functions over Downward Paths (5,3)</h3>
                  <p>Now we extend the XPath fragment defined in Section
				<a href="#sec-inner-predicates-on-downwards">2-8</a>, allowing the use
				of complex functions.</p>
                  <p>Complex functions may require a memory amount linear in the number
				of document nodes, regardless of the memory required to evaluate its arguments.</p>
                  <p>However, we can observe that the evaluation the current subset expressions,
				terminate by the end-tag of the context node.</p>
                  <p>For the remaining XPath subsets, we will not discuss about the
				evaluation of complex functions.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-booleans-on-forwards"/>Boolean Expressions over Forward Paths (1,4)</h3>
                  <p>In this section we extend the XPath fragment defined in
				Section <a href="#sec-booleans-on-dowards">2-5</a> (note that predicates
				and functions are avoided), allowing the use of forward axes. i.e.
				"following-sibling" and "following". An expression of the
				current subset is
				
<div class="codeblock">
                        <pre>descendant::a/following-sibling::b or following::a/child::b</pre>
                     </div>
				
                  </p>
                  <p>Consider the above expression. We can observe that, given a
				context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, the evaluation result might be available
				<i>after</i> the end-tag of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> (e.g.
				if <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> does not contain any <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> nodes), and possibly at the
				<i>endDocument</i> (e.g. if the input document does not contain any <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span>
				nodes).</p>
                  <p>For what concern the memory footprint, it is not difficult to find an
				algorithm using a memory linear in the document depth.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-simple-functions-on-forwards"/>Simple Functions over Forward Paths (2,4)</h3>
                  <p>Now, we extend the XPath subset defined in Section <a href="#sec-booleans-on-forwards">2-10</a>
				allowing the use of simple functions.</p>
                  <p>Similarly to what seen in Section <a href="#sec-simple-functions-on-downwards">2-6</a>
				for downward paths, we have that the streaming evaluation of expressions of the current
				subset requires a memory amount linear in the depth level of the document.</p>
                  <p>On the other hand, it is possible that the evaluation result is not available before
				the <i>endDocument</i>.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-tail-and-inner-predicates-on-forwards"/>Tail and Inner Predicate over Forward Paths (4,4)</h3>
                  <p>Now, we extend the XPath subset defined in <a href="#sec-simple-functions-on-forwards">2-11</a> allowing the use of
			 predicates. A current-subset expression is
				
<div class="codeblock">
                        <pre>following::*[count(following::a) lt 2]</pre>
                     </div>
				
                  </p>
                  <p>We do not distinguish among tail and inner predicates, because
				also for the evaluation of expressions with tail predicates only, a
				relevant amount of memory can be required.</p>
                  <p>Indeed, consider the expression shown above, and suppose it has
				to be evaluated using a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. In order to count all the
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> nodes, it is necessary to visit all the nodes following <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>.
				Thus, for each node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span> following <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, neither by its
				<i>startElement</i>, nor by its <i>endElement</i>, it is not possible to know if
				it is selected by the location path.  Thus, a streaming evaluator is
				forced to buffer <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>n</mml:mi>
                        </mml:math>
                     </span>. It is not difficult to find an input document
				s.t. the number of buffered nodes is linear in the number of nodes
				following the context node.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-booleans-and-simple-functions-on-absolute-paths"/>Booleans Expressions over Forward Absolute Location Paths (1,5)</h3>
                  <p>Now, we consider the set of XPath expressions obtained combining
				boolean connectors over both relative and absolute forward paths without predicates.</p>
                  <p>We can observe that, given a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, an absolute location
				path evaluation has to start at the beginning of the document rather than at the
				<i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. Moreover, in order to find all the nodes selected by an
				absolute location path, a streaming evaluator is forced to visit all the document nodes.
				However, if a streaming evaluator is interested in the <i>effective boolean value</i>
				
                     <b>
                        <span style="font-size:85%">
                           <a href="#xpathspec20" name="fromxpathspec20">[XPath2]</a>
                        </span>
                     </b>, it is possible that the location path is satisfied even
				<i>before</i> the <i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>.</p>
                  <p>In the general case it is necessary to wait for the end-document
				in order to know the evaluation result of an absolute path. Finally, since
				we are considering paths with no predicates, the required memory amount
				is linear in the document depth.</p>
                  <p>The same characteristics hold also if we extend the current XPath fragment
				with simple functions.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-tail-inner-predicates-over-absolute-paths"/>Tail and Inner Predicates over Forward Absolute Location Paths (4,5)</h3>
                  <p>Now we consider inner and tail predicates. Consider the expression
				
<div class="codeblock">
                        <pre>count(//*[//a]) eq 0</pre>
                     </div>
				and suppose it has to be evaluated on a document without any <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> element. The predicate
				is found to be false only at the end document. Before that, all the document elements
				have to be buffered. Clearly the required memory is linear in the size of the input document.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-booleans-over-backwards"/>Boolean Expressions over Backward Paths (1,1)</h3>
                  <p>In this section we extend the XPath subset discussed in <a href="#sec-booleans-on-attributes">2-2</a> allowing the use of relative
			 paths with <i>backward axes</i> only:
			 "parent", "ancestor", "preceding-sibling", and
			 "preceding".  Note, we are not allowing forward paths. An example of
			 such expressions is 
<div class="codeblock">
                        <pre>preceding::a and parent::b</pre>
                     </div>
			
                  </p>
                  <p>Clearly, given a context node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, the evaluation of an expression of the current
				subset cannot start at the <i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. However, suppose for a moment
				that we have a mechanism to evaluate reverse axes. Then, we can observe the evaluation
				result is available by the <i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>.</p>
                  <p>Now, we propose a mechanism to handle reverse axes. We describe it by an
				example. Consider the expression above. Before the evaluation process starts,
				the expression is transformed into the absolute location path
				
<div class="codeblock">
                        <pre>//*[preceding::a and parent::b]</pre>
                     </div>
				Such a location path selects all the nodes of the document satisfying the
				original expression. Then the obtained path is rewritten into an equivalent
				location path with forward axes only (see Section <a href="#sec-rewriting-algo">2-18</a>):
				<sup>
                        <span class="highlight">
                           <a href="#tod0e1220" name="fromd0e1220">4</a>
                        </span>
                     </sup>
				

                     <div class="codeblock">
                        <pre>//*[simple_let $var in . return //a[following::node() == $var] and //b[child::node() == $var]]</pre>
                     </div>
				
                  </p>
                  <p>The rewritten expression may contain absolute paths with
				predicates. We have stated in Section <a href="#sec-booleans-and-simple-functions-on-absolute-paths">2-13</a> that
				such expressions may require the buffering of relevant portions of the
				input document. However, if we consider boolean operators only, the
				buffering can be avoided. Indeed, in such cases we are interested in th
				effective boolean values of location paths. For instance, consider the
				expression 
<div class="codeblock">
                        <pre>//a[following::node() == $var]</pre>
                     </div> It is
				not necessary to find all the <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> elements, but rather that an
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> has been found.  Thus, it is equivalent to the expression
				
<div class="codeblock">
                        <pre>//a/following::node() == $var</pre>
                     </div> which does not have
				any predicates and thus requires no buffering.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-simple-functions-on-backwards"/>Simple Functions over Backward Paths (2,1)</h3>
                  <p>In this section we extend the XPath fragment described in Section
				<a href="#sec-booleans-over-backwards">2-15</a>, allowing the use of
				simple functions. Consider the expression:
				
<div class="codeblock">
                        <pre>count(preceding::a) &gt; 0</pre>
                     </div>
				Following the ideas shown in Section <a href="#sec-booleans-over-backwards">2-15</a>, the
				expression is rewritten into
				
<div class="codeblock">
                        <pre>//*[simple_let $var in . return count(//a[following::node() == $var]) &gt; 0]</pre>
                     </div>
				The nodes selected by the expression
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
					
                           <mml:mtext>//a[following::node() == $var]</mml:mtext>
				
                        </mml:math>
                     </span>
				must be exhaustively determined. It implies the buffering of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">a</mml:mi> 
                        </mml:math>
                     </span> elements. The
				use of the <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi mathvariant="monospace">$var</mml:mi>
                        </mml:math>
                     </span> impose an upper-bound on the buffered nodes.
				Indeed, if we are interested in the evaluation of the original expression using
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> as context node, than the number of buffered nodes is linear in the
				number of nodes preceding <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, rather than in the number of nodes of the
				entire document.
				</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-xpath-functions"/>XPath Functions</h3>
                  <p>XPath describes its built-in functions and operators in <b>
                        <span style="font-size:85%">
                           <a href="#xpath2-func-op" name="fromxpath2-func-op">[XPath2Op]</a>
                        </span>
                     </b>. The streaming evaluation of some of them
			 requires a relevant amount of memory regardless of the memory required
			 for the evaluation of their arguments. We call such functions <i>complex functions</i>. For the other functions,
			 the streaming evaluation does not require an amount of memory larger
			 than that required by the evaluation of their arguments. We call them
			 <i>simple functions</i>.</p>
                  <p>In a function call, an argument is either a constant value or
					a location paths. The former is not interesting for our discussions. Thus we consider
					only the latter. Moreover, as we can get rid of backward axes through a rewriting
					process, we consider forward paths only.</p>
                  <div class="subsec2">
                     <h4>
                        <a name="sec-simple-functions"/>Simple Functions</h4>
                     <p>Most XPath functions are simple. Here, we discuss some of
					 them.</p>
                     <p>For instance, consider value comparisons:  it applies to two
					sequences, but impose restrictions on the cardinalities of both
					arguments. Indeed, each argument sequence must contain either zero or
					one item: if it contains more than one item, an error has to be
					thrown.</p>
                     <p>Thus, suppose we have to evaluate, using a generic node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>e</mml:mi>
                           </mml:math>
                        </span> as
						context node, the expression <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>p1</mml:mi>
							
                              <mml:mo>valueComp</mml:mo>
							
                              <mml:mi>p2</mml:mi>
						
                           </mml:math>
                        </span>, where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>valueComp</mml:mi>
						
                           </mml:math>
                        </span> is a generic value comparison operator and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span> and
						<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span> are location paths. In order to evaluate this expression,
						there is no need to store the values of all the nodes selected by
						<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span>. Indeed, a streaming evaluator can store
						just the value of the first node selected by <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span>, and the value
						of the first node selected by <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span>: the comparison is then
						performed on these values.</p>
                     <p>Now, consider the expression <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>p1</mml:mi>
							
                              <mml:mo mathvariant="monospace">intersect</mml:mo>
							
                              <mml:mi>p2</mml:mi>
						
                           </mml:math>
                        </span>, where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span> are location paths.
						Suppose that in order to evaluate <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span>, buffering
						is not required (e.g. predicates are disallowed). If, given a
						context node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>e</mml:mi>
                           </mml:math>
                        </span>, there is a node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span> selected by both paths,
						then at the <i>startElement</i> of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span> a streaming evaluator finds
						that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span> belongs to the intersection. Thus, the evaluator can send
						an output event signaling that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span> belongs to the output
						sequence. Similarly, if <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span> does not belong to the intersection,
						at its <i>startElement</i> this can be immediately verified.</p>
                     <p>On the other hand, if <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p1</mml:mi>
                           </mml:math>
                        </span> and/or <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>p2</mml:mi>
                           </mml:math>
                        </span> requires
						buffering for their evaluation, also the evaluation of the
						intersection operator requires buffering.</p>
                     <p>In Figure <a href="#fig-complex-functions-list">4</a> we provide
						a complete list of <i>complex</i> functions. All the other
						XPath functions are simple.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="sec-complex-functions"/>Complex Functions</h4>
                     <p>Here we discuss some complex functions. Consider the expression
					<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
						
                              <mml:mi mathvariant="monospace">following::*</mml:mi>
						
                              <mml:mo mathvariant="monospace">,</mml:mo>
						
                              <mml:mi mathvariant="monospace">descendant::*</mml:mi>
					
                           </mml:math>
                        </span> and suppose it has to be evaluated w.r.t. a context node
					<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>e</mml:mi>
                           </mml:math>
                        </span>. The output of the expression must be the sequence of nodes
					obtained concatenating, in order, the nodes selected by the first location path,
					and the nodes selected by the second location path. Since the nodes selected
					by the second argument are visited before the nodes selected by the first argument,
					the nodes descending from <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>e</mml:mi>
                           </mml:math>
                        </span> have to be buffered
					until all the nodes following <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>e</mml:mi>
                           </mml:math>
                        </span> have not been visited.
					</p>
                     <p>Also the <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi mathvariant="monospace">for</mml:mi>
                           </mml:math>
                        </span> statement can require an amount of memory
					larger than the memory required to evaluate its arguments.
					Consider the expression <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mtext mathvariant="monospace">for $var := //* return
							//*</mml:mtext>
						
                           </mml:math>
                        </span>. The resulting sequence is the sequence of all the nodes of the
						document concatenated with itself as many times as many nodes are
						in the document. The buffering of the nodes selected by the return
						expression is unavoidable.</p>
                     <p>In Figure <a href="#fig-complex-functions-list">4</a> we list
						all the complex functions.</p>
                     <div class="figure">
                        <a name="fig-complex-functions-list"/>
                        <h5>Figure 4: Complete list of complex functions</h5>
                        <p>
							
                           <ul>
                              <li>fn:codepoint-to-string</li>
                              <li>fn:string-join</li>
                              <li>op:concatenate</li>
                              <li>fn:index-of</li>
                              <li>fn:distinct-values</li>
                              <li>fn:insert-before</li>
                              <li>fn:remove</li>
                              <li>fn:reverse</li>
                              <li>fn:subsequence</li>
                              <li>fn:deep-equal</li>
                              <li>fn:id</li>
                              <li>fn:idref</li>
                              <li>fn:doc</li>
                              <li>fn:collection</li>
                              <li>fn:position</li>
                              <li>fn:last</li>
                              <li>
                                 <span style="font-family: 'Lucida Sans Unicode'">
                                    <mml:math overflow="scroll">
										
                                       <mml:mo mathvariant="monospace">=</mml:mo>
									
                                    </mml:math>
                                 </span> (general equality)</li>
                              <li>
                                 <span style="font-family: 'Lucida Sans Unicode'">
                                    <mml:math overflow="scroll">
										
                                       <mml:mo mathvariant="monospace">!=</mml:mo>
									
                                    </mml:math>
                                 </span> (general inequality)</li>
                              <li>
                                 <span style="font-family: 'Lucida Sans Unicode'">
                                    <mml:math overflow="scroll">
                                       <mml:mi mathvariant="monospace">for</mml:mi>
                                    </mml:math>
                                 </span> expressions</li>
                              <li>conditional expression</li>
                           </ul>
							
                        </p>
                     </div>
                  </div>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-rewriting-algo"/>The Rewriting Algorithm</h3>
                  <p>For the sake of brevity in this paper we do not discuss our
				 rewriting algorithm, here we give some hints about it.
				 It is strongly based on the ideas shown in <b>
                        <span style="font-size:85%">
                           <a href="#omfb2002" name="fromomfb2002">[Olteanu02]</a>
                        </span>
                     </b>,
				where Dan Olteanu et al propose an algorithm to rewrite expressions of
				limited subset of XPath 1.0 <b>
                        <span style="font-size:85%">
                           <a href="#xpathspec10" name="fromxpathspec10">[XPath1]</a>
                        </span>
                     </b>
				into forward only location paths.
				We also adopt some ideas of <b>
                        <span style="font-size:85%">
                           <a href="#olteanu-symmetry" name="fromolteanu-symmetry">[Olteanu01]</a>
                        </span>
                     </b>, an extended version
				of <b>
                        <span style="font-size:85%">
                           <a href="#omfb2002" name="fromomfb2002">[Olteanu02]</a>
                        </span>
                     </b>, where some hints to handle the complete XPath 1.0
				language are provided.
				Indeed, our rewriting algorithm is able to handle all the expressions of the
				XPath 2.0 fragment equivalent to XPath 1.0, and extended with XPath 2.0
				specific functions.</p>
                  <p>The expressions produced by the rewriting process use two special
				constructs:
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
					
                           <mml:mtext mathvariant="monospace">simple_let</mml:mtext>
				
                        </mml:math>
                     </span> and
				<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
					
                           <mml:mtext mathvariant="monospace">==</mml:mtext>
				
                        </mml:math>
                     </span>. The former is equivalent to a XPath <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi mathvariant="monospace">for</mml:mi>
                        </mml:math>
                     </span> statement
				whose binding expression is either <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi mathvariant="monospace">self::node()</mml:mi>
                        </mml:math>
                     </span> or <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi mathvariant="monospace">/</mml:mi>
                        </mml:math>
                     </span>.
				The latter is an operator over node sequences, and it returns true iff their
				intersection is not empty.
				</p>
               </div>
            </div>
            <div class="section">
               <h2>
                  <a name="sec-latvia"/>The LATVIA Typing Discipline</h2>
               <p>Here we propose an approach to the streaming validation of CTA,
				where the conditions used to assign types are expressions taken from
				the complete XPath language. The idea is to evaluate all the
				conditions used within a schema using a lazy XPath evaluator which
				emits validation outcomes as soon as they are available, according to
				the timing constraints of the chosen XPath subset. The events produced
				by all XPath evaluators, one for each condition in the Schema, are
				listened to by the streaming validator.</p>
               <p>As observed in Section <a href="#sec-intro">1</a> the use of the
				complete XPath language to express conditions does not conform, in
				the general case, to the STEVE discipline currently followed by
				XML Schema. In this section we propose another discipline called LATVIA
				(<i>Lazy Assignment of Typing and Validity Infoset Aspects</i>). In LATVIA the
				type and the validity of an element are allowed to be decided
				<i>lazily</i>, i.e. the type is allowed
				(in the general case) to be decided at any moment after the start tag
				of the element, and the validity is allowed to be decided even after
				the end tag of the element.</p>
               <p>Here we describe the behavior that an XML Schema validator adopting CTA may
				provide when following the LATVIA discipline. When the start tag of an element
					<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> is read, the validator looks for an appropriate declaration which
					<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> can be validated against. Let <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>d</mml:mi>
				
                     </mml:math>
                  </span> be such a declaration. If <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>d</mml:mi>
				
                     </mml:math>
                  </span> is a conditional declaration, we say that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> is a <i>conditional element</i>. In such a
				case, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>d</mml:mi>
				
                     </mml:math>
                  </span> specifies several alternative type definitions. The actual type
					<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> has to be assigned to is one of such type definitions. Let <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>T</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> be the set of type definitions that can be assigned to <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span>. If <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> is not conditional, we can think of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>T</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> as a singleton, because it contains just one type definition.</p>
               <p>If <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>T</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> contains more than one type, the STEVE discipline cannot be
				applied. In such a case the validator informs the downstream application about the
				set of all the types that may be assigned to <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span>. Such a communication is accomplished through the emission of the output
				event <i>possibleTypes</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>). This implies that the
				content of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span> has to be validated against all the types of
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>.</p>
               <p>During the processing of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, all expressions whose evaluations
				fail have the effect of removing the corresponding type from the set
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>.  If at the end tag of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span> 
                  <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> still
				contains more than one type definition, the validator cannot assert the
				validity of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, and thus the STEVE discipline is not respected.
				However, for each type <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>t</mml:mi>
				
                     </mml:math>
                  </span> of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>T</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> the streaming validator decides whether <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> validates against <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>t</mml:mi>
				
                     </mml:math>
                  </span> or not. In this way, the validator obtains a validation result for
				each type in <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>T</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span>. The obtained results are collected in a set we call <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>V</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span>. Each member of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>V</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> is a pair <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mo>(</mml:mo>
					
                        <mml:mi>t</mml:mi>
					
                        <mml:mo>,</mml:mo>
					
                        <mml:mi>v</mml:mi>
					
                        <mml:mo>)</mml:mo>
				
                     </mml:math>
                  </span>, where <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>t</mml:mi>
				
                     </mml:math>
                  </span> is a type definition and <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>v</mml:mi>
				
                     </mml:math>
                  </span> is the result of validating <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>e</mml:mi>
				
                     </mml:math>
                  </span> against <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mi>t</mml:mi>
				
                     </mml:math>
                  </span>. <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:msub>
						
                           <mml:mi>V</mml:mi>
						
                           <mml:mi>e</mml:mi>
					
                        </mml:msub>
				
                     </mml:math>
                  </span> is communicated to the downstream application through the emission of
				the output event <i>possibleValidities</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>V</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>). In
				this manner, the downstream application is informed about all the possible
				validation results of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>.</p>
               <p>Based on the events received by the streaming evaluators, the validator decides
				which type a conditional element <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span> has to be assigned, and which types
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span> cannot be assigned. If the validator decides that an element <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>
				cannot be assigned a type <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>t</mml:mi>
                     </mml:math>
                  </span>, it removes such a type from <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>
				and informs the downstream application about such a removal. The communication is
				performed through the output event <i>removeType</i>( <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>t</mml:mi>
                     </mml:math>
                  </span>).
				Similarly, if the validator decides that an element <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span> has to be assigned
				type <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>t</mml:mi>
                     </mml:math>
                  </span>, it removes all the other types from <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi>e</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> and informs
				the downstream application about the type assignment. Again, such a communication is
				accomplished through the output event <i>assignType</i>( <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>e</mml:mi>
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>t</mml:mi>
                     </mml:math>
                  </span>).</p>
               <div class="figure">
                  <a name="fig-example-cta2"/>
                  <h5>Figure 5: (Yet another) Conditional declaration example</h5>
                  <pre>&lt;xs:element name="x" type="xs:anyType"&gt;
 <b>&lt;xs:alt cond="following::a" type="xs:decimal" /&gt;
 &lt;xs:alt cond="child::a"&gt;</b>
  &lt;xs:complexType&gt;
   &lt;xs:sequence&gt;
    &lt;xs:element name="a" type="xs:string" /&gt;
   &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
 <b>&lt;/xs:alt&gt;
 &lt;xs:alt cond="preceding::a" type="xs:integer" /&gt;</b>
&lt;/xs:element&gt;</pre>
               </div>
               <p>For instance, consider the element declaration of Figure <a href="#fig-example-cta2">5</a>, and suppose it has to be used to validate the element
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> of the document: 
<div class="codeblock">
                     <pre>&lt;r&gt;
 &lt;x&gt;
  &lt;a&gt;&lt;/a&gt;
 &lt;/x&gt;
&lt;/r&gt;
				</pre>
                  </div>
               </p>
               <p>Before the validation process starts, the validator transforms the three
				conditions of the declaration into three absolute location paths <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>p1</mml:mi>
                     </mml:math>
                  </span>,
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>p2</mml:mi>
                     </mml:math>
                  </span>, and <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>p3</mml:mi>
                     </mml:math>
                  </span>, and it instantiates a streaming evaluator for
				each of them. We call the evaluators <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p1</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p2</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>, and <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p3</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>.</p>
               <p>When the start tag of the element <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> is received by the validator, it
				forwards it to the three evaluators. As result, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p3</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> sends an output event
				to the validator, informing it that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> is not selected by <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:mi>p3</mml:mi>
                     </mml:math>
                  </span>. It
				means that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> does not satisfy the third condition of the declaration, i.e.
					<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mo mathvariant="monospace">preceding::</mml:mo>
					
                        <mml:mi mathvariant="monospace">a</mml:mi>
				
                     </mml:math>
                  </span>. Consequently, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> cannot be assigned type <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:integer</mml:mi> 
                     </mml:math>
                  </span>.
				Thus, the set of possible types of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> 
                  <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> is
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:decimal</mml:mi> 
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:anonymousType</mml:mi> 
                     </mml:math>
                  </span>, where <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:anonymousType</mml:mi> 
                     </mml:math>
                  </span> is the anonymous
				type definition. The validator sends the output event
				<i>possibleTypes</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>).</p>
               <p>When the start tag of the element <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">a</mml:mi> 
                     </mml:math>
                  </span> is reached, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p2</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> informs the
				validator that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> satisfies the second condition of the declaration.
				However, the validator cannot assert the type of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> yet, because it has to
				verify the first condition.</p>
               <p>At the end tag of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> contains more than one type. Thus,
				the validator validates <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> against both types of <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>T</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>, and
				constructs the set <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>V</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> with the members <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mo>(</mml:mo>
					
                        <mml:mi mathvariant="monospace">xs:decimal</mml:mi>
					
                        <mml:mo>,</mml:mo>
					
                        <mml:mi mathvariant="monospace">invalid</mml:mi>
					
                        <mml:mo>)</mml:mo>
				
                     </mml:math>
                  </span> and <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
					
                        <mml:mo>(</mml:mo>
					
                        <mml:mi mathvariant="monospace">anonymousType</mml:mi>
					
                        <mml:mo>,</mml:mo>
					
                        <mml:mi mathvariant="monospace">valid</mml:mi>
					
                        <mml:mo>)</mml:mo>
				
                     </mml:math>
                  </span>. Then, it sends the event <i>possibleValidities</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>,
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi>V</mml:mi>
                           <mml:mi mathvariant="monospace">x</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span>).</p>
               <p>Finally, at end of the document, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll">
                        <mml:msub>
                           <mml:mi mathvariant="italic">eval</mml:mi>
                           <mml:mi>p3</mml:mi>
                        </mml:msub>
                     </mml:math>
                  </span> informs the validator that
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> does not satisfy the first condition. Consequently, the validator assigns
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:anonymousType</mml:mi> 
                     </mml:math>
                  </span> to <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>, and removes <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:decimal</mml:mi> 
                     </mml:math>
                  </span> from <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>.
				The events generated by the validator are <i>removeType</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>,
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:decimal</mml:mi> 
                     </mml:math>
                  </span>) and <i>assignType</i>(<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span>, <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:anonymousType</mml:mi> 
                     </mml:math>
                  </span>).</p>
               <p>The last event implicitly states that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> is valid. Indeed, the validator
				previously informed the downstream application that <span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">x</mml:mi> 
                     </mml:math>
                  </span> validates against
				<span style="font-family: 'Lucida Sans Unicode'">
                     <mml:math overflow="scroll"> 
                        <mml:mi mathvariant="monospace">xs:anonymousType</mml:mi> 
                     </mml:math>
                  </span>.</p>
            </div>
            <div class="section">
               <h2>
                  <a name="sec-implementation"/>Implementation</h2>
               <p>As an assessment of the feasibility of a LATVIA-driven validator
			we have implemented our own prototype. It is a streaming validator of
			XML Schema schemata which can exhibit conditional type declarations in the
			syntax of Figures <a href="#fig-example-cta">3</a> and <a href="#fig-example-cta2">5</a>. It consumes as input a stream of SAX-like
			events and produces as output a stream of validation events like those
			discussed in Section <a href="#sec-latvia">3</a>.</p>
               <p>Such a prototype is necessarily composed of two distinct parts: a
			frontend consisting of a streaming evaluator of XPath conditions and a
			backend consisting of an XML Schema validator driven by the validation events
			produced by the frontend. In this section we describe the two parts in
			turn, emphasizing our novel algorithm for the streaming evaluation of
			XPath conditions <b>
                     <span style="font-size:85%">
                        <a href="#streaming-co-constraints-xml2006" name="fromstreaming-co-constraints-xml2006">[Marinelli06]</a>
                     </span>
                  </b>.</p>
               <div class="subsec1">
                  <h3>
                     <a name="sec-our-xpath-evaluator"/>Our Streaming XPath Evaluator</h3>
                  <p>Here we describe our streaming evaluator of the XPath conditions
				specified by a conditional declaration.</p>
                  <div class="figure">
                     <a name="fig-architecture"/>
                     <h5>Figure 6: Architecture of the streaming condition evaluator</h5>
                     <img src="EML2007mari122700.png" border="0"/>
                     <h5>[Link to <a href="EML2007mari122700.png" target="EML2007mari122700.png">open this graphic in a separate page</a>]</h5>
                  </div>
                  <p>The evaluation of an XPath condition of a conditional declaration is
					based on the architecture depicted in Figure <a href="#fig-architecture">6</a>.
					Let <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi>c</mml:mi>
					
                        </mml:math>
                     </span> be the condition, and <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> the name of the conditional
					declaration. The condition passes through a pre-processing phase consisting of
					two steps. The first step transforms the condition <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi>c</mml:mi>
					
                        </mml:math>
                     </span> into the absolute location path <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mo mathvariant="monospace">/descendant::</mml:mo>
						
                           <mml:mi>e</mml:mi>
						
                           <mml:mo>[</mml:mo>
						
                           <mml:mi>c</mml:mi>
						
                           <mml:mo>]</mml:mo>
					
                        </mml:math>
                     </span> selecting all the nodes whose name matches <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> and satisfying
						<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi>c</mml:mi>
					
                        </mml:math>
                     </span>. The second step transforms the obtained location path into a
					semantically equivalent expression with no reverse axes. The second step is
					performed applying the rewriting algorithm partially described in Section
					<a href="#sec-rewriting-algo">2-18</a>. Thus, the output of the pre-processing phase is an
					absolute location path of the form <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mo mathvariant="monospace">/descendant::</mml:mo>
						
                           <mml:mi>e</mml:mi>
						
                           <mml:mo>[</mml:mo>
						
                           <mml:mi>c</mml:mi>
						
                           <mml:mo>&#8242;</mml:mo>
						
                           <mml:mo>]</mml:mo>
					
                        </mml:math>
                     </span> where <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:msup>
							
                              <mml:mi>c</mml:mi>
							
                              <mml:mo>&#8242;</mml:mo>
						
                           </mml:msup>
					
                        </mml:math>
                     </span> is an expression with no reverse axes. </p>
                  <p>For instance, consider the declaration of Figure <a href="#fig-cond-decl-reverse">7</a>.
					An element validated against such a declaration is assigned type
					<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mtext mathvariant="monospace">3DCoordinate</mml:mtext>
					
                        </mml:math>
                     </span> if three-dimensional coordinates are required; the
					default type
					<span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mtext mathvariant="monospace">2DCoordinate</mml:mtext>
					
                        </mml:math>
                     </span> otherwise. The condition defined within the declaration is rewritten into


<div class="codeblock">
                        <pre>//coordinate[simple_let $var in . return //geometry[child::node() == $var]/@dimension eq '3D''']</pre>
                     </div>

					
                  </p>
                  <div class="figure">
                     <a name="fig-cond-decl-reverse"/>
                     <h5>Figure 7: A conditional declaration with a backward condition.</h5>
                     <p>


                        <div class="codeblock">
                           <pre>&lt;xs:element name="coordinate" type="2DCoordinate"&gt;
 &lt;xs:alt cond="parent::geometry/@dimension eq '3D' type="3DCoordinate" /&gt;
&lt;/xs:element&gt;
</pre>
                        </div>
						
                     </p>
                  </div>
                  <p>The evaluation is performed on the location path resulting from the
					pre-processing phase. Thus, relatively to the XPath stratification outlined
					in Section <a href="#sec-xpath-stratification">2</a>, our streaming evaluator
					works on expressions of the subset identified by the cell (5, 5) of the stratification
					table. Indeed, the rewriting process may produce expressions with
					absolute location paths with predicates. Moreover, general comparisons are allowed,
					as well as inner predicates.</p>
                  <p> The algorithm used to evaluate the location path is
					event-based, i.e. it receives a sequence of SAX-like events describing the XML
					document which the location path has to be evaluated on. The output of the
					algorithm is a sequence of events emitted during the evaluation process and
					signaling which nodes <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi mathvariant="monospace">e</mml:mi>
					
                        </mml:math>
                     </span> are and which nodes <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi mathvariant="monospace">e</mml:mi>
					
                        </mml:math>
                     </span> are not selected by the location path. Note that through such output
					events, the evaluator indirectly informs about which nodes <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi mathvariant="monospace">e</mml:mi>
					
                        </mml:math>
                     </span> satisfy and which nodes <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi mathvariant="monospace">e</mml:mi>
					
                        </mml:math>
                     </span> do not satisfy the original condition <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
						
                           <mml:mi mathvariant="monospace">c</mml:mi>
					
                        </mml:math>
                     </span>. The input and output events are those defined <a href="#sec-sax-parser">2-1</a>.</p>
                  <p>In order to evaluate in streaming the location path resulting from the
					pre-processing phase, we propose an algorithm that extends &#967;&#945;o&#962; <b>
                        <span style="font-size:85%">
                           <a href="#xaos2003" name="fromxaos2003">[Barton03]</a>
                        </span>
                     </b> (an algorithm for the streaming evaluation of absolute
					location paths). We do not directly use &#967;&#945;o&#962; because it does not support
					all the features of our XPath fragment.</p>
                  <p>In the next sections we give a description of our algorithm for the streaming
					evaluation of an absolute location path with no reverse axes. Before that we
					briefly describe &#967;&#945;o&#962; to facilitate the reader in understanding our
					algorithm.</p>
                  <div class="subsec2">
                     <h4>
                        <a name="sec-xaos-dsc"/>A Gentle Introduction to &#967;&#945;o&#962;</h4>
                     <p>&#967;&#945;o&#962; is an event-based algorithm for the streaming evaluation of an
						absolute location path possibly with reverse axes. Its purpose is to
						construct a compact representation of the node-set selected by the location
						path.</p>
                     <p>&#967;&#945;o&#962; is based on a restricted subset of XPath 1.0.<sup>
                           <span class="highlight">
                              <a href="#tod0e2548" name="fromd0e2548">5</a>
                           </span>
                        </sup> Indeed, it
						does not allow axes other than "ancestor", "parent",
						"child", and "descendant"; no function is handled and just
						the <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">and</mml:mo>
						
                           </mml:math>
                        </span> operator is supported. Moreover, &#967;&#945;o&#962; does not allow
						absolute location paths within a predicate of a location step.</p>
                     <p>Before the evaluation process starts, &#967;&#945;o&#962; creates two
						representations of the location path: an x-tree and an x-dag. The <i>x-tree</i> is a tree data-structure similar to an AST [Abstract Syntax Tree] of the XPath expression. Each node of the tree is
						called <i>x-node</i> and corresponds to the
						node-test of a location-step. The edges connecting the x-nodes are called
							<i>x-edges</i>. An x-edge connecting an
						x-node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>u</mml:mi>
						
                           </mml:math>
                        </span> to a child x-node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> represents a location step from <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>u</mml:mi>
						
                           </mml:math>
                        </span> to <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span>, and it is denoted by <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>u</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>. Each x-edge is labeled with the axis specifier of the
						corresponding location step. The <i>x-dag</i>
						is a <i>Directed Acyclic Graph</i> (DAG) DAG [Direct Acyclic Graph] obtained from the x-tree. It is mainly used to handle the
						reverse axes.</p>
                     <p>For what concerns the streaming evaluation of the location path,
						&#967;&#945;o&#962; progressively constructs the node-set it selects. As soon as a
						node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> matches the node-test represented by an x-node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span>, &#967;&#945;o&#962; creates a data-structure called <i>matching-structure</i>, which is a pair associating
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> to <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>, denoted by <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>. In order to know when a matching-structure has to be created,
						&#967;&#945;o&#962; makes use of the <i>looking-for
						set</i>. It is a set of pairs <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>l</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> is an x-node and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> is either an integer or a <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">*</mml:mo>
						
                           </mml:math>
                        </span>. The presence of a member <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>l</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> within the looking-for set means that at the depth level
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> a node matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> is expected.<sup>
                           <span class="highlight">
                              <a href="#tod0e2745" name="fromd0e2745">6</a>
                           </span>
                        </sup> Thus, if &#967;&#945;o&#962; receives the start-tag of an element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> and within the looking-for set there is a pair <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>l</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> such that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> matches <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> and its depth level satisfies <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span>, then a matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created. The looking-for set is then updated inspecting the
						outgoing edges of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> and based on the depth level of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>.</p>
                     <p>The looking-for set is initialized to the pair <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>Root</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>0</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> which states that at depth level 0, the root of the document is
						expected. Thus, at the start document event the matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>Root</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>0</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created (0 is the identifier of the root of the document).</p>
                     <p>The matching-structures are interconnected in parent-child relationships.
						Given an x-edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> labeled with "descendant" and a matching-structure
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>, if the algorithm finds that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> has a descendant node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
						
                           </mml:math>
                        </span> matching the node-test <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
						
                           </mml:math>
                        </span>, a matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created, and it is added as child matching-structure to
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>. <sup>
                           <span class="highlight">
                              <a href="#tod0e2999" name="fromd0e2999">7</a>
                           </span>
                        </sup>
					
                     </p>
                     <p>A fundamental concept of &#967;&#945;o&#962; is that of <i>total matching</i>. A matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is said to be a total matching if for each outgoing edge
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span>, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> has at least one sub-matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> that in turn is a total matching. If <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> has no outgoing edges, trivially <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is a total matching.</p>
                     <p>In the case reverse axes are <i>not</i>
						present, at the end tag of an element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>, it is always possible to decide if a matching-structure
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is a total matching or not, because the allowed axes are
						downward, and thus the nodes potentially matching the x-nodes descending
						from <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> have been read. If at the end tag of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>
						
                        <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is not a total matching, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is removed, and thus cannot figure as a sub-matching of its
						parent-matching.</p>
                     <p>The presence of reverse axes involves the procedure to decide if a
						matching-structure is a total matching. However, we do not discuss the
						implications of their presence, because our streaming evaluator works on a
						reverse-axes-free location path, and thus they are not interesting for the
						discussion of our algorithm.</p>
                     <p>Finally, if at the end document event the matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>Root</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>0</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is found to be a total matching, then the location path has
						selected at least one node. The nodes selected can be obtained from the
						matching-structures associated to the x-node corresponding to the last
						location step of the input location path.</p>
                     <p>In the next sections we present our algorithm for the evaluation of
						location paths, emphasizing the differences with respect to &#967;&#945;o&#962;.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="t4-1-2"/>Absolute Location Paths in Predicates</h4>
                     <p>Our algorithm supports the use of absolute location paths within a
						predicate. All absolute location paths are evaluated in parallel, and are
						represented by distinct x-trees. For this reason, we say that our algorithm
						represents the input location path through an <i>x-forest</i>. Moreover, if the node-test represented by an
						x-node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> has an absolute location path <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>p</mml:mi>
						
                           </mml:math>
                        </span> as predicate, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> is connected to the x-tree <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>t</mml:mi>
						
                           </mml:math>
                        </span> representing <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>p</mml:mi>
						
                           </mml:math>
                        </span> through a special x-edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>t</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> called <i>x-tree-edge</i>. An
						x-tree-edge has no label.</p>
                     <p>In order to handle reverse axes, &#967;&#945;o&#962; resorts to a graph
						data-structure called <i>x-dag</i> representing
						the location path. Since our algorithm works on a reverse-axes-free location
						path, the x-dag is not necessary.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="t4-1-3"/>The Use of DFAs</h4>
                     <p>Although our algorithm works on a location path with no reverse axes, it
						accepts all the forward ones (including "following" and
						"following-sibling"). This has some implications in deciding whether
						a matching-structure has a sub-matching or not. In fact, let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> be an x-node with an outgoing edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> labeled with "following-sibling", and let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> be a node matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span>, whose depth-level is <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span>. In order to decide that the matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> has no sub-matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> it is not sufficient to wait for the end-tag of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>, but rather for the end tag of the parent of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>.</p>
                     <p>This behavior is implemented by our algorithm as follows. When the
						matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created, a DFA able to recognize all the
						nodes within the "following-sibling" axis of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> and matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
						
                           </mml:math>
                        </span> is created. We say that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>
                        <i>depends on</i> such a
							DFA, which is deallocated when the end-tag of the
						parent of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> is reached. If during its life-cycle the DFA
						has not recognized any node, then it is possible to assert that <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> has no sub-matching relative to the x-edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>.</p>
                     <p>In general, when a matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created, the outgoing edges of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> within the x-tree are analyzed. For each edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> labeled with an axis specifier <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>a</mml:mi>
						
                           </mml:math>
                        </span>, the algorithm instantiates a DFA able to
						recognize all the nodes of the axis <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>a</mml:mi>
						
                           </mml:math>
                        </span> of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span> and matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
						
                           </mml:math>
                        </span>. Such a DFA is described by the tuple
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>a</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>v', l</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span>, where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> is the depth-level of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>. The depth-level <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> is necessary for computing the transitions among the states of
						the automata.</p>
                     <p>Each DFA has an initial state, some intermediate
						states, one or more final states, and a sink state. Once the sink state is
						reached, the DFA is deallocated. When a DFA
						<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>a</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>v', l</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> receives the start element event of an element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
						
                           </mml:math>
                        </span>, and through such input it transits into a final state, a new
						matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>e</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created. Our DFAs replace the looking-for
						set of &#967;&#945;o&#962;.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="t4-1-4"/>Operators and Functions</h4>
                     <p>Every operator and function present within the location path to evaluate,
						is represented through an x-node.</p>
                     <p>If the x-node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>o</mml:mi>
						
                           </mml:math>
                        </span> represents an operator or a function, the edge connecting it to
						its parent <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> is a special x-edge with no label, called <i>x-pred-edge</i>.</p>
                     <p>Now, let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> be an x-node representing a location step node-test, and
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>o</mml:mi>
						
                           </mml:math>
                        </span> be an operator used at the top-level of a predicate of such
						location step. If during the evaluation process a matching-structure
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> has to be created, the algorithm also creates a special
						matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> called <i>evaluator-structure</i>.
						Such structure has the purpose of evaluating the operator <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>o</mml:mi>
						
                           </mml:math>
                        </span> with respect to the context node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>.</p>
                     <p>For an evaluator-structure, talking about total matching does not make
						sense. Rather, each evaluator-structure has a current value, that is updated
						during the evaluation process, based on the operators semantics. When the
						current value of an evaluator-structure cannot change anymore, we say it is
							<i>stabilized</i>. Once its current value
						is stabilized, the evaluator-structure communicates it to the
						parent-matching.</p>
                     <p>Now, we are going to explain the stabilization of the value of an
						evaluator-structure. Since the stabilization depends on the semantics of the
						relevant function or operator, we take into consideration a single case,
						i.e. that of the operator <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">or</mml:mo>
						
                           </mml:math>
                        </span>. Other operators and functions are handled similarly. Consider
						the expression<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mstyle mathvariant="monospace">
								
                                 <mml:mo>child::a</mml:mo>
								
                                 <mml:mo>or</mml:mo>
								
                                 <mml:mo>following-sibling::b</mml:mo>
							
                              </mml:mstyle>
						
                           </mml:math>
                        </span>.</p>
                     <p>Let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>o</mml:mi>
						
                           </mml:math>
                        </span> be the x-node representing the boolean operator <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">or</mml:mo>
						
                           </mml:math>
                        </span> It has two outgoing edges: <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>a</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> (labeled with "child") and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>b</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> (labeled with "following-sibling"), where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>a</mml:mi>
						
                           </mml:math>
                        </span> is the x-node representing the node-test <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">a</mml:mi>
						
                           </mml:math>
                        </span> and
						<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>b</mml:mi>
						
                           </mml:math>
                        </span> is the x-node representing the node-test <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">b</mml:mi>
						
                           </mml:math>
                        </span>. When an evaluator-structure <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is created, its value is set to <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">false</mml:mi>
						
                           </mml:math>
                        </span>. The algorithm also creates two DFAs:
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>1</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> ("child", <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>a</mml:mi>
						
                           </mml:math>
                        </span>, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span>) and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>2</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> ("following-sibling", <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>b</mml:mi>
						
                           </mml:math>
                        </span>, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span>), where <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> is the depth level of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>.</p>
                     <p>Now, suppose that during the evaluation process at least one of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>1</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>2</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> transits into a final state. For instance, suppose that
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>1</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> finds an element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">a</mml:mi>
						
                           </mml:math>
                        </span>. For the semantics of the <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">or</mml:mo>
						
                           </mml:math>
                        </span> operator applied to node-sets, it is sufficient to assert that
						the current value of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll"> 
                              <mml:mi mathvariant="monospace">true</mml:mi> 
                           </mml:math>
                        </span>, and that it is to be considered stabilized.
						Consequently, it is not necessary to hold <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>1</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>2</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> active, and thus they are deallocated.</p>
                     <p>On the other hand, in order to decide that the stabilized value of
							<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>o</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is stabilized, it is necessary to wait that both <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>1</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi>d</mml:mi>
								
                                 <mml:mn>2</mml:mn>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> transit into their sink states, without having been transited
						into a final state.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="t4-1-5"/>Total Matching and Propagation</h4>
                     <p>In our algorithm, a matching-structure has a state indicating whether it
						is either a <i>total matching</i>, a <i>potential total matching</i>, or a <i>no total matching</i> (i.e. it will never be a
						total matching). When a matching-structure becomes a total matching, it
						propagates its state to its parent-matching. Analogously, when it is a no
						total matching, its state is propagated to the parent-matching.</p>
                     <p>Let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> be a matching-structure,<sup>
                           <span class="highlight">
                              <a href="#tod0e4226" name="fromd0e4226">8</a>
                           </span>
                        </sup> and let <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>l</mml:mi>
						
                           </mml:math>
                        </span> be the depth level of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>e</mml:mi>
						
                           </mml:math>
                        </span>. <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is a total matching if the appropriate case holds: <ol type="1">
                           <li>
                              <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mi>v</mml:mi>
									
                                 </mml:math>
                              </span> has no outgoing edge;</li>
                           <li> for each outgoing edge <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:mi>v</mml:mi>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span>: <ol type="1">
                                 <li>if <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:mi>v</mml:mi>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> is an x-pred-edge, the value of the
												sub-matching <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:mi>e</mml:mi>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> has to be stabilized, and its conversion
												into a boolean value <sup>
                                       <span class="highlight">
                                          <a href="#tod0e4354" name="fromd0e4354">9</a>
                                       </span>
                                    </sup> has to return <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">true</mml:mi> 
                                       </mml:math>
                                    </span>;</li>
                                 <li> otherwise, if <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:mi>v</mml:mi>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> is an x-tree-edge (i.e. <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                       </mml:math>
                                    </span> is an x-tree), the matching-structure
												<span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:msub>
												
                                             <mml:mi>Root</mml:mi>
												
                                             <mml:msup>
												
                                                <mml:mi>v</mml:mi>
												
                                                <mml:mo>&#8242;</mml:mo>
												
                                             </mml:msup>
												
                                          </mml:msub>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:mn>0</mml:mn>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> (where <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:msub>
												
                                             <mml:mi>Root</mml:mi>
												
                                             <mml:msup>
												
                                                <mml:mi>v</mml:mi>
												
                                                <mml:mo>&#8242;</mml:mo>
												
                                             </mml:msup>
												
                                          </mml:msub>
												
                                       </mml:math>
                                    </span> is the x-node representing the root of
												the x-tree <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                       </mml:math>
                                    </span>) has to be a total-matching. </li>
                                 <li> otherwise (i.e. <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:mi>v</mml:mi>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> is an x-edge as those of &#967;&#945;o&#962;),
												there is at least one sub-matching <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
												
                                          <mml:mo>(</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>v</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>,</mml:mo>
												
                                          <mml:msup>
												
                                             <mml:mi>e</mml:mi>
												
                                             <mml:mo>&#8242;</mml:mo>
												
                                          </mml:msup>
												
                                          <mml:mo>)</mml:mo>
												
                                       </mml:math>
                                    </span> representing a total matching. </li>
                              </ol>
								
                           </li>
                        </ol>
					
                     </p>
                     <p> On the other hand, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:mi>e</mml:mi>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> is a no total matching if <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi>v</mml:mi>
						
                           </mml:math>
                        </span> has at least one outgoing edge <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo>(</mml:mo>
							
                              <mml:mi>v</mml:mi>
							
                              <mml:mo>,</mml:mo>
							
                              <mml:msup>
								
                                 <mml:mi>v</mml:mi>
								
                                 <mml:mo>&#8242;</mml:mo>
							
                              </mml:msup>
							
                              <mml:mo>)</mml:mo>
						
                           </mml:math>
                        </span> such that the appropriate case holds: <ol type="1">
                           <li> if <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:mi>v</mml:mi>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> is an x-pred-edge (i.e. <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
									
                                 </mml:math>
                              </span> is an operator or a function), the value of the
									evaluator-structure <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:mi>e</mml:mi>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> is stabilized, and its conversion into a boolean
									value returns <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll"> 
                                    <mml:mi mathvariant="monospace">false</mml:mi> 
                                 </mml:math>
                              </span>. </li>
                           <li> if <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:mi>v</mml:mi>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> is an x-tree-edge (i.e. <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
									
                                 </mml:math>
                              </span> is an x-tree), the matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:msub>
											
                                       <mml:mi>Root</mml:mi>
											
                                       <mml:msup>
												
                                          <mml:mi>v</mml:mi>
												
                                          <mml:mo>&#8242;</mml:mo>
											
                                       </mml:msup>
										
                                    </mml:msub>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:mn>0</mml:mn>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> is a no total matching. </li>
                           <li> if <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:mi>v</mml:mi>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> is an x-edge labeled with an axis specifier
										<span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mi>a</mml:mi>
									
                                 </mml:math>
                              </span>, there is no sub-matching <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>v</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:msup>
											
                                       <mml:mi>e</mml:mi>
											
                                       <mml:mo>&#8242;</mml:mo>
										
                                    </mml:msup>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> and the DFA
									<span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
										
                                    <mml:mo>(</mml:mo>
										
                                    <mml:mi>a</mml:mi>
										
                                    <mml:mo>,</mml:mo>
										
                                    <mml:mi>v', l</mml:mi>
										
                                    <mml:mo>)</mml:mo>
									
                                 </mml:math>
                              </span> has been deallocated. </li>
                        </ol>
					
                     </p>
                     <p>Note that, in order to decide if a matching-structure is a total matching
						or a no total matching, it is not always necessary to wait for the
						deallocation of all its DFAs. For instance, consider the
						following location path: <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">/descendant::x[child::a]</mml:mo>
						
                           </mml:math>
                        </span> and suppose it has to be evaluated on the instance document: 
<div class="codeblock">
                           <pre>&lt;doc&gt;
 &lt;x&gt;
  &lt;a /&gt;
  ...
  &lt;a /&gt;
 &lt;/x&gt;
&lt;/doc&gt;</pre>
                        </div> When the start tag of the first element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">a</mml:mi>
						
                           </mml:math>
                        </span> is processed, the algorithm can assert the element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">x</mml:mi>
						
                           </mml:math>
                        </span> has a child <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">a</mml:mi>
						
                           </mml:math>
                        </span> and thus it is a node selected by the location path. It is not
						necessary to wait for the end tag of <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">x</mml:mi>
						
                           </mml:math>
                        </span>. </p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="sec-xpath-impl-evaluation-outcome"/>Evaluation Outcome</h4>
                     <p>The purpose of &#967;&#945;o&#962; is to construct the node-set selected by the
						input location path. On the other hand, the purpose of our algorithm is to
						signal through output events which nodes are and which are not selected by
						the location path.</p>
                     <p>The output events are <i>willNeverBeSatisfied</i>(id) and <i>satisfied</i>(id).
						The former tells that the node identified by <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">id</mml:mi>
						
                           </mml:math>
                        </span> is not selected by the location path; the latter tells that the
						node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mi mathvariant="monospace">id</mml:mi>
						
                           </mml:math>
                        </span> is selected by the location path.</p>
                  </div>
                  <div class="subsec2">
                     <h4>
                        <a name="t4-1-7"/>Evaluation Example</h4>
                     <p>In this section we show an example of execution of our algorithm. The
						location path is: <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:mo mathvariant="monospace">/descendant::x[child::a or
								/descendant::b]</mml:mo>
						
                           </mml:math>
                        </span> The associated x-forest is depicted in Figure <a href="#fig-x-forest">8</a>. </p>
                     <div class="figure">
                        <a name="fig-x-forest"/>
                        <h5>Figure 8:  X-forest associated to the XPath <span style="font-family: 'Lucida Sans Unicode'">
                              <mml:math overflow="scroll">
								
                                 <mml:mo mathvariant="monospace">/descendant::x[child::a or
									/descendant::b]</mml:mo>
							
                              </mml:math>
                           </span>
						
                        </h5>
                        <img src="EML2007mari122701.png" border="0"/>
                        <h5>[Link to <a href="EML2007mari122701.png" target="EML2007mari122701.png">open this graphic in a separate page</a>]</h5>
                        <div style="font-size:85%">
                           <p class="first">There are two <i>x-trees</i>:
								the right one represents the path <span style="font-family: 'Lucida Sans Unicode'">
                                 <mml:math overflow="scroll">
									
                                    <mml:mo mathvariant="monospace">/descendant::b</mml:mo>
								
                                 </mml:math>
                              </span>.</p>
                        </div>
                     </div>
                     <p> The instance document is:<sup>
                           <span class="highlight">
                              <a href="#tod0e4896" name="fromd0e4896">10</a>
                           </span>
                        </sup>
						

                        <div class="codeblock">
                           <pre>&lt;r 1, 1&gt;
 &lt;x 2, 2&gt;
  &lt;a 3, 3&gt;&lt;/a 3, 3&gt;
 &lt;/x 2, 2&gt;
 &lt;b 4, 2&gt;&lt;/b 4, 2&gt;
 &lt;x 5, 2&gt;&lt;/x 5, 2&gt;
&lt;/r 1, 1&gt;</pre>
                        </div>
					
                     </p>
                     <p> The execution of our algorithm on such a document is shown in the table
						below, where we only consider element nodes. The start- and end-tag
						contain information about the name of the element, the node identifier
						and the depth level, and they are respectively denoted as <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi mathvariant="monospace">S</mml:mi>
								
                                 <mml:mrow>
									
                                    <mml:mi>n</mml:mi>
									
                                    <mml:mo>,</mml:mo>
									
                                    <mml:mi>i</mml:mi>
									
                                    <mml:mo>,</mml:mo>
									
                                    <mml:mi>l</mml:mi>
								
                                 </mml:mrow>
							
                              </mml:msub>
						
                           </mml:math>
                        </span> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
							
                              <mml:msub>
								
                                 <mml:mi mathvariant="monospace">E</mml:mi>
								
                                 <mml:mrow>
									
                                    <mml:mi>n</mml:mi>
									
                                    <mml:mo>,</mml:mo>
									
                                    <mml:mi>i</mml:mi>
									
                                    <mml:mo>,</mml:mo>
									
                                    <mml:mi>l</mml:mi>
								
                                 </mml:mrow>
							
                              </mml:msub>
						
                           </mml:math>
                        </span>. </p>
                     <div class="table">
                        <h5>Table 2: Sample execution of our algorithm to evaluate <span style="font-family: 'Lucida Sans Unicode'">
                              <mml:math overflow="scroll">
								
                                 <mml:mo mathvariant="monospace">/descendant::x[child::a or
									/descendant::b]</mml:mo>
							
                              </mml:math>
                           </span>
                        </h5>
                        <table summary="Sample execution of our algorithm to evaluate &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;/descendant::x[child::a or&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;/descendant::b]&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;" border="1" width="85%">
                           <colgroup>
                              <col/>
                              <col/>
                           </colgroup>
                           <thead>
                              <tr>
                                 <th>Input events</th>
                                 <th>Comments</th>
                              </tr>
                           </thead>
                           <tbody>

								

                              <tr>
                                 <td>Start document.</td>
                                 <td>The algorithm creates two matching-structures <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monispace">Root</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mn>0</mml:mn>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>, one for each x-tree. An element <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">x</mml:mi> 
                                       </mml:math>
                                    </span> and
										an element <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">b</mml:mi> 
                                       </mml:math>
                                    </span> are now looked for.</td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi>S</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">r</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>1</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>1</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td>Ignored.</td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">S</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">x</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> A matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mrow>
												
                                             <mml:mo>(</mml:mo>
												
                                             <mml:mi mathvariant="monospace">x</mml:mi>
												
                                             <mml:mo>,</mml:mo>
												
                                             <mml:mn>2</mml:mn>
												
                                             <mml:mo>)</mml:mo>
											
                                          </mml:mrow>
										
                                       </mml:math>
                                    </span> is created. Since <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">x</mml:mi> 
                                       </mml:math>
                                    </span> has an outgoing
										x-pred-edge, an evaluator-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>2</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is created too, and it is added as sub-matching
										of <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">x</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mn>2</mml:mn>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>. The matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">Root</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mn>0</mml:mn>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> of the second x-tree is added as sub-matching of
											<span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mn>2</mml:mn>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>. Finally, the current value of <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mn>2</mml:mn>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is set to <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">false</mml:mi> 
                                       </mml:math>
                                    </span>. An element <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">a</mml:mi> 
                                       </mml:math>
                                    </span>
										child of node 2 is now looked for. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">S</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">a</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>3</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>3</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td>A matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mrow>
												
                                             <mml:mo>(</mml:mo>
												
                                             <mml:mi mathvariant="monospace">a</mml:mi>
												
                                             <mml:mo>,</mml:mo>
												
                                             <mml:mn>3</mml:mn>
												
                                             <mml:mo>)</mml:mo>
											
                                          </mml:mrow>
										
                                       </mml:math>
                                    </span> is created. Since the x-node <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">a</mml:mi> 
                                       </mml:math>
                                    </span> has no
										outgoing edges, <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">a</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>3</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is a total matching, and it propagates its state
										to <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>2</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>, which updates its value to <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">true</mml:mi> 
                                       </mml:math>
                                    </span>.
										According to the semantics of the <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">or</mml:mi> 
                                       </mml:math>
                                    </span> operator, the
										value of <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>2</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is considered stabilized. The stabilized value
										<span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">true</mml:mi> 
                                       </mml:math>
                                    </span> is propagated to <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">x</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>2</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>, which is thus found to be a total matching.
										Since the x-node <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">x</mml:mi> 
                                       </mml:math>
                                    </span> represents the node-test of the
										last location step of the input location path, the algorithm
										outputs <i>satisfied</i>(2). </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">E</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">a</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>3</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>3</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> Ignored. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">E</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">x</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> Ignored. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">S</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">b</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>4</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> A matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">b</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>4</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is created. <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">b</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>4</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is a total matching, and thus it propagates its
										state to the matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">Root</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>0</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> relative to the second x-tree. Such a
										matching-structure updates its state to total matching.
									</td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">E</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">b</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>4</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> Ignored. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">S</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">x</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>5</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> A matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">x</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is created. An evaluator-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is instanced and added as sub-matching of
											<span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">x</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>. The matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">Root</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>0</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> of the second x-tree is added as sub-matching of
											<span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>. Since <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">Root</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>0</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is a total matching, the value of <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">or</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span> is set to <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll"> 
                                          <mml:mi mathvariant="monospace">true</mml:mi> 
                                       </mml:math>
                                    </span> and it is also considered
										stabilized. Consequently, it is propagated to the
										matching-structure <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:mo>(</mml:mo>
											
                                          <mml:mi mathvariant="monospace">x</mml:mi>
											
                                          <mml:mo>,</mml:mo>
											
                                          <mml:mi>5</mml:mi>
											
                                          <mml:mo>)</mml:mo>
										
                                       </mml:math>
                                    </span>, which is then found to be a total matching.
										Consequently, the output event <i>satisfied</i>(5) is
										emitted. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">E</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">x</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>5</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>2</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> Ignored. </td>
                              </tr>

								

                              <tr>
                                 <td>
										
                                    <span style="font-family: 'Lucida Sans Unicode'">
                                       <mml:math overflow="scroll">
											
                                          <mml:msub>
												
                                             <mml:mi mathvariant="monospace">E</mml:mi>
												
                                             <mml:mrow>
												
                                                <mml:mi mathvariant="monospace">r</mml:mi>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>1</mml:mn>
												
                                                <mml:mo>,</mml:mo>
												
                                                <mml:mn>1</mml:mn>
												
                                             </mml:mrow>
											
                                          </mml:msub>
										
                                       </mml:math>
                                    </span>
									
                                 </td>
                                 <td> Ignored. </td>
                              </tr>

								

                              <tr>
                                 <td>End document.</td>
                                 <td>Ignored.</td>
                              </tr>

							
                           </tbody>
                        </table>
                     </div>
                  </div>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-latvia-model-implementation"/>The LATVIA Model Implementation</h3>
                  <p>We propose here an implementation of a streaming validator for XML Schema schemata
				augmented with CTA.</p>
                  <p>As already stated, our implementation works on conditions in the subset
				(5, 5) of the stratification table proposed in Section <a href="#sec-xpath-stratification">2</a>.
				As a consequence, given a conditional element <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, in order to know the type it is
				assigned, it might be required to wait for the evaluation end of a condition put on nodes
				following <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>. In such a case, the actual type of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> is known
				<i>after</i> its end-tag. In other words, our CTA implementation
				follows the LATVIA discipline.</p>
                  <p>Given a conditional declaration, our implementation creates a streaming evaluator
				for each condition specified with the declaration. Each streaming evaluator signals
				the nodes satisfying the corresponding condition. Such events are those described in
				Section <a href="#sec-xpath-impl-evaluation-outcome">4-1-6</a>.</p>
                  <p>Each time our validator receives an event from an XPath evaluator stating
				that a node <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> satisfies a condition <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>c</mml:mi>
                        </mml:math>
                     </span>, it checks whether the <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> type
				depends on such conditions. In such a case, the validator assigns <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> with the
				type corresponding to the condition <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>c</mml:mi>
                        </mml:math>
                     </span>, and it communicates the type
				assignment to the downstream application.
				<sup>
                        <span class="highlight">
                           <a href="#tod0e5872" name="fromd0e5872">11</a>
                        </span>
                     </sup>
                  </p>
                  <p>Similarly, if the validator receives an event from a streaming XPath evaluator
				stating that an element <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> does not satisfy a condition <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>c</mml:mi>
                        </mml:math>
                     </span>, then it
				removes the corresponding type from the potential type list of <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span>, and communicates
				the type removal to the downstream application.</p>
                  <p>The potential type list of a conditional element <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll">
                           <mml:mi>e</mml:mi>
                        </mml:math>
                     </span> is held in an hash table. The
				keys are the conditional element numeric identifiers.</p>
                  <p>The events generated by the streaming evaluator are those defined in
				Section <a href="#sec-latvia">3</a>. Conditional elements are identified through
				their numeric identifiers.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-code"/>Working Prototype</h3>
                  <p>We have implemented a streaming SchemaPath validator, patching the Java
					source code of Xerces2 <b>
                        <span style="font-size:85%">
                           <a href="#xerces2" name="fromxerces2">[Xerces2]</a>
                        </span>
                     </b>, a streaming XML Schema
					validating parser. The streaming evaluation of the XPath conditions
					is performed by a Java implementation of the algorithm described in Section
						<a href="#sec-our-xpath-evaluator">4-1</a>.</p>
                  <p>The implementation is a prototype. It has some limitations concerning both the
					streaming validator and the XPath evaluator. For instance, our validator
					does not correctly handle the default attributes when conditionally
					declared.  Furthermore, some functions and operators are not handled.
					Such limitations have not been overcome yet but they do not
					invalidate the approach of the implementation.</p>
                  <p>Our SchemaPath validator and XPath evaluator are free
				 software and are available on the web for downloaded at
				 <a href="http://vitali.web.cs.unibo.it/Progetti/LaTVia" target="_blank">http://vitali.web.cs.unibo.it/Progetti/LaTVia</a>.</p>
               </div>
               <div class="subsec1">
                  <h3>
                     <a name="sec-related-work"/>Related Works</h3>
                  <p>Validating XML Schema and evaluating XPath expressions in a streaming
				fashion have become an increasing need of applications. Applicative
				scenarios in which these needs have been previously shown include
				selective dissemination of information <b>
                        <span style="font-size:85%">
                           <a href="#xfilter" name="fromxfilter">[Altinel00]</a>
                        </span>
                     </b>,
				notification systems <b>
                        <span style="font-size:85%">
                           <a href="#xml-data-on-the-web" name="fromxml-data-on-the-web">[Nguyen01]</a>
                        </span>
                     </b>, and
				routing of XML packets <b>
                        <span style="font-size:85%">
                           <a href="#mesh-based-content-routing" name="frommesh-based-content-routing">[Snoeren01]</a>
                        </span>
                     </b>.
				To our knowledge, a clear definition of how the term "streaming" is used
				in the context of XML processing is lacking. Previous attempts in the
				literature tend to stress two arguments: the sub-linearity of memory
				usage with respect to the input document, and the computational
				efficiency of the algorithms employed. The first argument is peculiar
				especially for applicative areas in which continuous and potentially
				infinite flows of XML-encoded information need to be processed, as in
				these areas the requirement of an in-memory representation of the whole
				input document is, trivially, impossible to satisfy.</p>
                  <p>The literature about both the need and the current solutions for
				streaming validation against XML Schema is starting to appear. A recent
				work is <i>XML Screamer</i> 
                     <b>
                        <span style="font-size:85%">
                           <a href="#xml-screamer" name="fromxml-screamer">[Kostoulas06]</a>
                        </span>
                     </b>, a compiler for XML Schema producing extremely
				efficient validating parsers that groups, for optimization purposes, the
				phases of parsing, validation, and de-serialization. XML Screamer
				significantly differs from our work, because it produces parsers taking
				into account the processing of XML documents, from their scanning to
				their de-serialization. In a sense, we are more generic, focusing only
				on validation, enabling the reuse of other techniques for the other
				phases.</p>
                  <p>On the other hand, several previous works have addressed the issue
				of how to evaluate in a streaming fashion one or more XPath
				expressions, but all of them fail to address the full expressivity of
				XPath, for one reason or another. XFilter <b>
                        <span style="font-size:85%">
                           <a href="#xfilter" name="fromxfilter">[Altinel00]</a>
                        </span>
                     </b>
				is the precursor of the streaming evaluation of XPath expressions; it
				is based on the idea of transforming location path expressions in
				DFA [Deterministic Finite
					Automaton], but can only handle
				straight-line expressions (i.e. with no branching nor predicates).
				YFilter <b>
                        <span style="font-size:85%">
                           <a href="#yfilter" name="fromyfilter">[Diao03]</a>
                        </span>
                     </b> is an extension of XFilter that
				factorizes common parts of multiple expressions using non-deterministic
				finite state automata to achieve greater efficiency in processing large
				sets of XPath expressions (hundreds of thousands) at once. XTrie
				<b>
                        <span style="font-size:85%">
                           <a href="#xtrie" name="fromxtrie">[Chan02]</a>
                        </span>
                     </b> and TurboXPath <b>
                        <span style="font-size:85%">
                           <a href="#turboxpath" name="fromturboxpath">[Josifovski05]</a>
                        </span>
                     </b>
				relax the straight-line requirement and handle tree-shaped expressions
				and predicates.  Nonetheless, all the mentioned approaches fail to
				handle all XPath reverse axes, i.e. axes required to "look backward"
				in document order with respect to the context node, like "preceding"
				or "ancestor".</p>
                  <p>&#967;&#945;o&#962; <b>
                        <span style="font-size:85%">
                           <a href="#xaos2003" name="fromxaos2003">[Barton03]</a>
                        </span>
                     </b> was the first approach to
				perform stream evaluation of XPath with branching, predicates, and
				dealing with reverse axis.  It is the basis of our approach and it has
				been described in Section <a href="#sec-xaos-dsc">4-1-1</a>. In
				spite of being a great improvement in the field &#967;&#945;o&#962; still fails to
				address the whole range of XPath, restricting the supported axis to a
				strict subset of what described in the full language, handling no
				functions, and supporting only the <span style="font-family: 'Lucida Sans Unicode'">
                        <mml:math overflow="scroll"> 
                           <mml:mi mathvariant="monospace">and</mml:mi> 
                        </mml:math>
                     </span> boolean operator. In this
				paper we claim that we started off extending &#967;&#945;o&#962; to support a larger
				subset of XPath. The only additional ingredient we use is a static
				rewriting algorithm <b>
                        <span style="font-size:85%">
                           <a href="#omfb2002" name="fromomfb2002">[Olteanu02]</a>
                        </span>
                     </b>, which we use to deal
				with reverse axes in XPath expressions, simplifying the internal
				machinery of &#967;&#945;o&#962;.</p>
               </div>
            </div>
            <h3 class="footnotes">Notes</h3>
            <table class="footnotes">
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e116" name="tod0e116">
                           <b>1.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">unless otherwise specified, in
					this paper we will use "XPath" to refer to XPath 2.0,
					i.e. version 2.0 of the XPath specification <b>
                           <span style="font-size:85%">
                              <a href="#xpathspec20" name="fromxpathspec20">[XPath2]</a>
                           </span>
                        </b> 
                     </p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e198" name="tod0e198">
                           <b>2.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">
					For those who have followed the evolution of the XML Schema specifications
					this probably does not come as a surprise: such specifications have an
					history of being overly restrictive. Just to mention a paradigmatic
					example, <b>
                           <span style="font-size:85%">
                              <a href="#xsd-expressiveness-upa" name="fromxsd-expressiveness-upa">[Bex05]</a>
                           </span>
                        </b> discusses the
					effect of the UPA [Unique
						Particle Attribution] mechanism and
					arguments how the desired benefits can be obtained in a cleaner
					manner, broadening the set of valid Schema documents.
				 </p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e543" name="tod0e543">
                           <b>3.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">If we do not consider reverse axes, predicates on attributes are useless.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e1220" name="tod0e1220">
                           <b>4.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">The simple_let construct is used to bind a variable to
				a <i>single</i> node of the input document.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e2548" name="tod0e2548">
                           <b>5.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">As XPath 1.0 can be seen as a subset of XPath 2.0, we can state
						that &#967;&#945;o&#962; works on a limited fragment of XPath 2.0.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e2745" name="tod0e2745">
                           <b>6.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first"> If <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mi>l</mml:mi>
								
                           </mml:math>
                        </span> is <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mo mathvariant="monospace">*</mml:mo>
								
                           </mml:math>
                        </span>, the node matching <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mi>v</mml:mi>
								
                           </mml:math>
                        </span> is expected at any depth level.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e2999" name="tod0e2999">
                           <b>7.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">In this case, <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mo>(</mml:mo>
									
                              <mml:mi>v</mml:mi>
									
                              <mml:mo>,</mml:mo>
									
                              <mml:mi>e</mml:mi>
									
                              <mml:mo>)</mml:mo>
								
                           </mml:math>
                        </span> is said the <i>parent-matching</i> and <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mo>(</mml:mo>
									
                              <mml:msup>
										
                                 <mml:mi>v</mml:mi>
										
                                 <mml:mo>&#8242;</mml:mo>
									
                              </mml:msup>
									
                              <mml:mo>,</mml:mo>
									
                              <mml:msup>
										
                                 <mml:mi>e</mml:mi>
										
                                 <mml:mo>&#8242;</mml:mo>
									
                              </mml:msup>
									
                              <mml:mo>)</mml:mo>
								
                           </mml:math>
                        </span> the <i>sub-matching</i>.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e4226" name="tod0e4226">
                           <b>8.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first"> We are not discussing about an evaluator-structure, thus
									<span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
									
                              <mml:mi>v</mml:mi>
								
                           </mml:math>
                        </span> is assumed to be an x-node representing a
							node-test.</p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e4354" name="tod0e4354">
                           <b>9.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first"> The conversion rules are those defined by
												XPath. </p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e4896" name="tod0e4896">
                           <b>10.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first"> The numbers used within the start and end tags of the elements
								are respectively the node identifier and the depth level. </p>
                  </td>
               </tr>
               <tr>
                  <td class="ftnote-num" valign="top" width="10%" align="right">
                     <p class="first">
                        <a href="#fromd0e5872" name="tod0e5872">
                           <b>11.</b>
                        </a>
                     </p>
                  </td>
                  <td valign="top">
                     <p class="first">Given a condition <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>c</mml:mi>
                           </mml:math>
                        </span> our streaming evaluator finds every node <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span>
					of the input document such that it satisfies <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>c</mml:mi>
                           </mml:math>
                        </span>. However, as homonymous local
					(conditional) element declaration are allowed, it is possible that an element <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>n</mml:mi>
                           </mml:math>
                        </span>
					satisfying <span style="font-family: 'Lucida Sans Unicode'">
                           <mml:math overflow="scroll">
                              <mml:mi>c</mml:mi>
                           </mml:math>
                        </span> has a non-conditional declaration.</p>
                  </td>
               </tr>
            </table>
            <hr class="hr"/>
            <h3>
               <i>Acknowledgments</i>
            </h3>
            <p class="first">The authors would like to thank Noah Mendelsohn, Michael Sperberg-McQueen, and
				David Ezell for comments, criticisms, and encouragements on this work and the
				fruitful discussions within the XML Schema Working Group. We would also like to
				thank Claudio Sacerdoti Coen and Jacopo Zingoni for their help with SchemaPath
				and co-constraint specification and management. </p>
            <hr class="hr"/>
            <h3>
               <i>Bibliography</i>
            </h3>
            <p>
               <b>
                  <a name="xfilter" href="#fromxfilter">[Altinel00] </a>
               </b>  Mehmet Altinel and Michael J. Franklin. Efficient filtering of XML documents
					for selective dissemination of information. In <i>proceedings of the 26th international conference on Very Large Data Bases
						(VLDB)</i>, pages 53--64, 2000. </p>
            <p>
               <b>
                  <a name="xaos2003" href="#fromxaos2003">[Barton03] </a>
               </b>  Charles M. Barton, Philippe G. Charles, Deepak Goyal, Mukund Raghavachari,
					Vanja Josifovski, and Marcus F. Fontoura. Streaming XPath Processing with
					Forward and Backward Axes. In <i>proceedings of the 19th
						International Conference on Data Engineering (ICDE)</i>, pages
					455--466, Bangalore, India, March 2003. </p>
            <p>
               <b>
                  <a name="xpath-memory-requirements" href="#fromxpath-memory-requirements">[BarYossef04] </a>
               </b>  Ziv Bar-Yossef, Marcus Fontoura, and Vanja Josifovski. On the Memory
					Requirements of XPath Evaluation over XML Streams. In <i>Proceedings of the twenty-third ACM SIGMOD-SIGACT-SIGART
						symposium on Principles of database systems</i>, June 2004, Paris,
					France, ACM Press, pages 177-188, 2004. </p>
            <p>
               <b>
                  <a name="xsd-expressiveness-upa" href="#fromxsd-expressiveness-upa">[Bex05] </a>
               </b>  Geert Jan Bex, Wim Martens, Frank Neven, Thomas Schwentick.
				Expressiveness of XSDs: from practice to theory, there and back again.
				In <i>Proceedings of WWW'05: the 14th international
				 conference on World Wide Web</i>, pages 712--721, Chiba, Japan.
				ACP Press.
			 </p>
            <p>
               <b>
                  <a name="xtrie" href="#fromxtrie">[Chan02] </a>
               </b>  Chee Yong Chan, Pascal Felber, Minos N. Garofalakis, and Rajeev Rastogi.
					Efficient filtering of XML documents with XPath expressions. <i>The VLDB Journal, The International Journal on Very Large Data
						Bases</i>, 11(4):354--379, 2002. </p>
            <p>
               <b>
                  <a name="co-constraints-esw-wiki" href="#fromco-constraints-esw-wiki">[CoConstrWiki] </a>
               </b>  Co-occurrence constraints. Page on the ESW Wiki, official W3C Wiki for
					discussing standard specifications,
						<a href="http://esw.w3.org/topic/Co-occurrence_constraints" target="_blank">http://esw.w3.org/topic/Co-occurrence_constraints</a>. </p>
            <p>
               <b>
                  <a name="yfilter" href="#fromyfilter">[Diao03] </a>
               </b>  Yanlei Diao and Michael J. Franklin. High-performance XML filtering: An
					overview of YFilter. <i>IEEE Data Engineering
					Bullettin</i>, 26(1):41--48, 2003. </p>
            <p>
               <b>
                  <a name="dom" href="#fromdom">[Dom] </a>
               </b>  Arnaud Le Hors, Philippe Le H&#233;garet, et al. Document Object Model (DOM) Level
					2 Core Specification. Version 1.0.
					<a href="http://www.w3.org/TR/DOM-Level-2-Core/" target="_blank">http://www.w3.org/TR/DOM-Level-2-Core/</a>, 13 November 2000. <i>W3C Recommendation</i>. </p>
            <p>
               <b>
                  <a name="fpmlspec" href="#fromfpmlspec">[FpML] </a>
               </b> 
				Financial products Markup Language.
				<a href="http://www.fpml.org/" target="_blank">http://www.fpml.org/</a>
				
            </p>
            <p>
               <b>
                  <a name="turboxpath" href="#fromturboxpath">[Josifovski05] </a>
               </b>  Vanja Josifovski, Marcus Fontoura, and Attila Barta. Querying XML streams.
						<i>The VLDB Journal, The International Journal on Very
						Large Data Bases</i>, 14(2):197--210, 2005. </p>
            <p>
               <b>
                  <a name="xml-screamer" href="#fromxml-screamer">[Kostoulas06] </a>
               </b>  Margaret G. Kostoulas, Morris Matsa, Noah Mendelsohn, Eric Perkins, Abraham
					Heifets, and Martha Mercaldi. XML screamer: an integrated approach to high
					performance xml parsing, validation and deserialization. In <i>proceedings of WWW'06: the 15th international conference on
						World Wide Web</i>, pages 93--102, New York, NY, USA, 2006. ACM
					Press. </p>
            <p>
               <b>
                  <a name="schemapathWWW04" href="#fromschemapathWWW04">[Marinelli04] </a>
               </b>  Paolo Marinelli, Claudio Sacerdoti Coen, and Fabio Vitali. SchemaPath, a
					Minimal Extension to XML Schema for Conditional Constraints. In <i>proceedings of WWW'04: the 13th international conference on
						World Wide Web</i>, New York, May 2004. </p>
            <p>
               <b>
                  <a name="streaming-co-constraints-xml2006" href="#fromstreaming-co-constraints-xml2006">[Marinelli06] </a>
               </b>  Paolo Marinelli and Stefano Zacchiroli. Co-constraint validation in a
					streaming context. In <i>proceedings of XML
					2006</i>, Boston, MA, December 2006. </p>
            <p>
               <b>
                  <a name="xml-data-on-the-web" href="#fromxml-data-on-the-web">[Nguyen01] </a>
               </b>  Benjamin Nguyen, Serge Abiteboul, Gregory Cobena, and Mihai Preda. Monitoring
					XML data on the web. In <i>proceeding of the 2001 ACM
						SIGMOD international conference on Management of data</i>, pages
					437--448, 2001. </p>
            <p>
               <b>
                  <a name="olteanu-symmetry" href="#fromolteanu-symmetry">[Olteanu01] </a>
               </b>  Dan Olteanu, Holger Meuss, Tim Furche, and Francois Bry. Symmetry in
					XPath. Technical Report PMS-FB-2001-16, Institute of Computer Science,
					University of Munich, Munich, Germany, 2001. </p>
            <p>
               <b>
                  <a name="omfb2002" href="#fromomfb2002">[Olteanu02] </a>
               </b>  Dan Olteanu, Holger Meuss, Tim Furche, and Francois Bry. XPath: Looking
					forward. In <i>proceedings of the EDBT Workshop on XML Data
						Management (XMLDM)</i> Prague, Czech Republic, March 2002, volume
					2490 of Lecture Notes in Computer Science, pages 109--127. Springer-Verlag.
				</p>
            <p>
               <b>
                  <a name="sax" href="#fromsax">[Sax] </a>
               </b> The SAX project <a href="http://www.saxproject.org" target="_blank">http://www.saxproject.org</a>, 2007.</p>
            <p>
               <b>
                  <a name="mesh-based-content-routing" href="#frommesh-based-content-routing">[Snoeren01] </a>
               </b>  Alex C. Snoeren, Kenneth Conley, and David K. Gifford. Mesh based content
					routing using XML. In <i>proceedings of SOSP: the 18th ACM
						Symposium on Operating Systems Principles</i>, October 2001, pages
					160--173, 2001. </p>
            <p>
               <b>
                  <a name="ublspec" href="#fromublspec">[UBL] </a>
               </b> 
				Jon Bosak, Tim McGrat, and G. Ken Holman.
				Universal Business Language v2.0,
				December 2006.
				<i>Oasis Standard</i>.
				</p>
            <p>
               <b>
                  <a name="xerces2" href="#fromxerces2">[Xerces2] </a>
               </b>  Xerces2 Java parser. <a href="http://xerces.apache.org/xerces2-j/" target="_blank">http://xerces.apache.org/xerces2-j/</a>, 2007. The
					Apache XML project. </p>
            <p>
               <b>
                  <a name="xhtmlspec" href="#fromxhtmlspec">[XHTML] </a>
               </b> Steven Pemberton <i>et al</i>.
				 XHTML 1.0 The Extensible HyperText Markup Language (Second Edition).
				 <a href="http://www.w3.org/TR/xhtml1/" target="_blank">http://www.w3.org/TR/xhtml1/</a>,
				 January 2000.
				 <i> W3C Recommendation</i>.
				</p>
            <p>
               <b>
                  <a name="xmlschema-draft" href="#fromxmlschema-draft">[XMLSchema] </a>
               </b>  Henry S. Thompson, David Beech, Murray Maloney, and Noah Mendelsohn. XML Schema
					1.1 part 1: Structures.
						<a href="http://www.w3.org/TR/2006/WD-xmlschema11-1-20060831/" target="_blank">http://www.w3.org/TR/2006/WD-xmlschema11-1-20060831/</a>, August
					2006. <i>W3C Working Draft.</i>
				
            </p>
            <p>
               <b>
                  <a name="xpathspec10" href="#fromxpathspec10">[XPath1] </a>
               </b>  James Clark and Steve DeRose. XML Path Language (XPath) version 1.0.
						<a href="http://www.w3.org/TR/xpath" target="_blank">http://www.w3.org/TR/xpath</a>, November 1999. <i>W3C Recommendation</i>. </p>
            <p>
               <b>
                  <a name="xpathspec20" href="#fromxpathspec20">[XPath2] </a>
               </b>  Anders Berglund, Scott Boag, Don Chamberlin, Mary F. Fern&#225;ndez, Michael Kay,
					Jonathan Robie, and J&#233;r&#244;me Sim&#233;on. XML Path Language (XPath) 2.0.
						<a href="http://www.w3.org/TR/2006/CR-xpath20-20060608/" target="_blank">http://www.w3.org/TR/2006/CR-xpath20-20060608/</a>, June 2006.
						<i>W3C Candidate Recommendation</i>. </p>
            <p>
               <b>
                  <a name="xpath2-func-op" href="#fromxpath2-func-op">[XPath2Op] </a>
               </b>  Ashok Malhotra, Jim Melton, Norman Walsh. XQuery 1.0 and XPath 2.0 Functions
					and Operators. <a href="http://www.w3.org/TR/xpath-functions/" target="_blank">http://www.w3.org/TR/xpath-functions/</a>, January 2007.
						<i>W3C Recommendation</i>. </p>
            <p>
               <b>
                  <a name="xsltspec" href="#fromxsltspec">[XSLT] </a>
               </b> James Clark.
				XSL Transformations (XSLT).
				<a href="http://www.w3.org/TR/xslt" target="_blank">http://www.w3.org/TR/xslt</a>,
				November 1999.
				<i> W3C Recommendation</i>.
				</p>
            <hr class="hr"/>
            <hr class="hr"/>
            <p class="footertitle">Streaming Validation of Schemata: the Lazy Typing Discipline</p>
            <address>Paolo Marinelli [University of Bologna, Department of Computer Science]<br class="br"/>
               <a href="mailto:pmarinel@cs.unibo.it" class="mailto">pmarinel@cs.unibo.it</a>
            </address>
            <address>Fabio Vitali [University of Bologna, Department of Computer Science]<br class="br"/>
               <a href="mailto:fabio@cs.unibo.it" class="mailto">fabio@cs.unibo.it</a>
            </address>
            <address>Stefano Zacchiroli [University of Bologna, Department of Computer Science]<br class="br"/>
               <a href="mailto:zacchiro@cs.unibo.it" class="mailto">zacchiro@cs.unibo.it</a>
            </address>
            <hr class="hr"/>
         </div>
      </div>
   </body>
</html>
