Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  3. <!--
  4.  Copyright (c) 2003 World Wide Web Consortium,
  5.  
  6.  (Massachusetts Institute of Technology, European Research Consortium for
  7.  Informatics and Mathematics, Keio University). All Rights Reserved. This
  8.  work is distributed under the W3C(r) Software License [1] in the hope that
  9.  it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  10.  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11.  
  12.  [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
  13. -->
  14.  
  15. <!DOCTYPE test SYSTEM "dom3.dtd" [
  16.   <!ENTITY % entities SYSTEM "dom3xpathents.ent">
  17.   %entities;
  18. ]>
  19. <test xmlns="&level3;" name="Conformance_ID">
  20.   <metadata>
  21.     <title>Conformance_ID</title>
  22.     <creator>Bob Clary</creator>
  23.     <description>
  24.       1.3 Conformance - Check that the element returned by XPath id() function
  25.       returns the same element as Document.getElementById
  26.     </description>
  27.     <date qualifier="created">2003-12-02</date>
  28.     <subject resource="&spec;#Conformance"/>
  29.     <subject resource="&spec;#XPathEvaluator"/>
  30.     <subject resource="&spec;#XPathEvaluator-createNSResolver"/>
  31.     <subject resource="&spec;#XPathNSResolver"/>
  32.     <subject resource="&spec;#XPathEvaluator-evaluate"/>
  33.     <subject resource="&spec;#XPathResult-iterateNext"/>
  34.   </metadata>
  35.  
  36.   <!-- Standard Variables -->
  37.  
  38.   <var name="ANY_TYPE"                     type="short" value="0"/>
  39.   <var name="NUMBER_TYPE"                  type="short" value="1"/>
  40.   <var name="STRING_TYPE"                  type="short" value="2"/>
  41.   <var name="BOOLEAN_TYPE"                 type="short" value="3"/>
  42.   <var name="UNORDERED_NODE_ITERATOR_TYPE" type="short" value="4"/>
  43.   <var name="ORDERED_NODE_ITERATOR_TYPE"   type="short" value="5"/>
  44.   <var name="UNORDERED_NODE_SNAPSHOT_TYPE" type="short" value="6"/>
  45.   <var name="ORDERED_NODE_SNAPSHOT_TYPE"   type="short" value="7"/>
  46.   <var name="ANY_UNORDERED_NODE_TYPE"      type="short" value="8"/>
  47.   <var name="FIRST_ORDERED_NODE_TYPE"      type="short" value="9"/>
  48.  
  49.   <var name="doc"           type="Document"/>
  50.   <var name="resolver"      type="XPathNSResolver"/>
  51.   <var name="evaluator"     type="XPathEvaluator"/>
  52.   <var name="contextNode"   type="Node"/>
  53.   <var name="inresult"      type="XPathResult" isNull="true"/>
  54.   <var name="outresult"     type="XPathResult" isNull="true"/>
  55.  
  56.   <!-- Inputs -->
  57.  
  58.   <var name="expression"  type="DOMString" value="&quot;id('child1')&quot;"/>
  59.   <var name="xpathType"   type="short"     value="ANY_TYPE"/>
  60.  
  61.   <!-- Test Variables -->
  62.  
  63.   <var name="outNode"       type="Node"/>
  64.   <var name="child1Element" type="Node"/>
  65.  
  66.   <!-- Load Test Document -->
  67.  
  68.   <load var="doc" href="internaldtd" willBeModified="false"/>
  69.  
  70.   <!-- Get XPathResult -->
  71.  
  72.   <createXPathEvaluator var="evaluator" document="doc"/>
  73.   <createNSResolver obj="evaluator" var="resolver" nodeResolver="doc"/>
  74.  
  75.   <assign var="contextNode" value="doc"/>
  76.  
  77.   <evaluate obj="evaluator"
  78.             var="outresult"
  79.             expression="expression"
  80.             contextNode="contextNode"
  81.             resolver="resolver"
  82.             type="xpathType"
  83.             result="inresult"
  84.             interface="XPathEvaluator" />
  85.  
  86.   <!-- Test Body -->
  87.  
  88.   <iterateNext var="outNode" obj="outresult"/>
  89.  
  90.   <getElementById var="child1Element"
  91.                   obj="doc"
  92.                   elementId="&quot;child1&quot;"/>
  93.  
  94.   <assertSame id="S1.3-Conformance-ID"
  95.               actual="outNode"
  96.               expected="child1Element"/>
  97.  
  98. </test>
  99.