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="XPathNSResolver_lookupNamespaceURI_nist_dmstc">
  20.   <metadata>
  21.     <title>XPathNSResolver_lookupNamespaceURI_nist_dmstc</title>
  22.     <creator>Bob Clary</creator>
  23.     <description>
  24.       Interate over all employee elements with xmlns:dmstc attribute
  25.       in the test document, creating nsresolvers checking that
  26.       for all children the prefix 'nist' resolves to
  27.       http://www.nist.gov and that prefix 'dmstc' resolves to the same
  28.       value as employee.getAttribute('xmlns:dmstc').
  29.     </description>
  30.     <date qualifier="created">2003-12-09</date>
  31.     <subject resource="&spec;#XPathEvaluator"/>
  32.     <subject resource="&spec;#XPathEvaluator-createNSResolver"/>
  33.     <subject resource="&spec;#XPathNSResolver"/>
  34.     <subject resource="&spec;#XPathNSResolver-lookupNamespaceURI"/>
  35.   </metadata>
  36.  
  37.   <!-- Standard Variables -->
  38.  
  39.   <var name="doc"                 type="Document" />
  40.   <var name="resolver"            type="XPathNSResolver" />
  41.   <var name="evaluator"           type="XPathEvaluator" />
  42.  
  43.   <!-- Test Variables -->
  44.  
  45.   <var name="lookupNamespaceURI" type="DOMString"/>
  46.   <var name="namespaceURI" type="DOMString"/>
  47.   <var name="child"        type="Element"/>
  48.   <var name="children"     type="NodeList"/>
  49.   <var name="employee"      type="Element"/>
  50.   <var name="employees"     type="NodeList"/>
  51.  
  52.   <!-- Load Test Document -->
  53.  
  54.   <load var="doc" href="staffNS" willBeModified="false"/>
  55.  
  56.   <getElementsByTagNameNS obj="doc"
  57.                           interface="Document"
  58.                           var="employees"
  59.                           namespaceURI="&quot;*&quot;"
  60.                           localName="&quot;employee&quot;"
  61.                           />
  62.  
  63.   <createXPathEvaluator var='evaluator'
  64.                         document='doc'/>
  65.  
  66.  
  67.   <for-each member="employee"
  68.             collection="employees">
  69.  
  70.  
  71.     <getAttribute obj="employee"
  72.                   interface="Element"
  73.                   name="&quot;xmlns:dmstc&quot;"
  74.                   var="namespaceURI"
  75.                   />
  76.  
  77.     <getElementsByTagNameNS obj="employee"
  78.                             interface="Element"
  79.                             var="children"
  80.                             namespaceURI="&quot;*&quot;"
  81.                             localName="&quot;*&quot;"
  82.                             />
  83.  
  84.     <for-each member="child"
  85.               collection="children">
  86.  
  87.       <createNSResolver obj="evaluator"
  88.                         var="resolver"
  89.                         nodeResolver="child"
  90.                         />
  91.  
  92.       <lookupNamespaceURI obj="resolver"
  93.                           interface="XPathNSResolver"
  94.                           var="lookupNamespaceURI"
  95.                           prefix="&quot;dmstc&quot;"
  96.                           />
  97.  
  98.       <assertEquals id="dmstcequal"
  99.                     actual="lookupNamespaceURI"
  100.                     expected="namespaceURI"
  101.                     ignoreCase="false"
  102.                     />
  103.  
  104.       <lookupNamespaceURI obj="resolver"
  105.                           interface="XPathNSResolver"
  106.                           var="lookupNamespaceURI"
  107.                           prefix="&quot;nist&quot;"
  108.                           />
  109.  
  110.       <assertEquals id="nistequal"
  111.                     actual="lookupNamespaceURI"
  112.                     expected="&quot;http://www.nist.gov&quot;"
  113.                     ignoreCase="false"
  114.                     />
  115.     </for-each>
  116.  
  117.   </for-each>
  118.  
  119. </test>
  120.