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="XPathResult_TYPE_ERR">
  20.   <metadata>
  21.     <title>XPathResult_TYPE_ERR</title>
  22.     <creator>Bob Clary</creator>
  23.     <description>
  24.       Create an XPathResult for the expression /staff/employee
  25.       for each type of XPathResultType, checking that TYPE_ERR
  26.       is thrown when inappropriate properties and methods are accessed.
  27.     </description>
  28.     <date qualifier="created">2003-12-02</date>
  29.     <subject resource="&spec;#TYPE_ERR"/>
  30.     <subject resource="&spec;#XPathException"/>
  31.     <subject resource="&spec;#XPathResult"/>
  32.     <subject resource="&spec;#XPathResultType"/>
  33.     <subject resource="&spec;#XPathEvaluator-createNSResolver"/>
  34.     <subject resource="&spec;#XPathResult-resultType"/>
  35.     <subject resource="&spec;#XPathResult-booleanValue"/>
  36.     <subject resource="&spec;#XPathResult-numberValue"/>
  37.     <subject resource="&spec;#XPathResult-singleNodeValue"/>
  38.     <subject resource="&spec;#XPathResult-snapshot-length"/>
  39.     <subject resource="&spec;#XPathResult-stringValue"/>
  40.     <subject resource="&spec;#XPathResult-iterateNext"/>
  41.     <subject resource="&spec;#XPathResult-snapshotItem"/>
  42.   </metadata>
  43.  
  44.   <var name="doc"                          type="Document"/>
  45.   <var name="resolver"                     type="XPathNSResolver"/>
  46.   <var name="evaluator"                    type="XPathEvaluator"/>
  47.   <var name="expression"                   type="DOMString"
  48.                                            value="&quot;/staff/employee&quot;"/>
  49.   <var name="contextNode"                  type="Node"/>
  50.   <var name="inresult"                     type="XPathResult" isNull="true"/>
  51.   <var name="outresult"                    type="XPathResult" isNull="true"/>
  52.   <var name="inNodeType"                   type="short"/>
  53.   <var name="outNodeType"                  type="short"/>
  54.   <var name="ANY_TYPE"                     type="short" value="0"/>
  55.   <var name="NUMBER_TYPE"                  type="short" value="1"/>
  56.   <var name="STRING_TYPE"                  type="short" value="2"/>
  57.   <var name="BOOLEAN_TYPE"                 type="short" value="3"/>
  58.   <var name="UNORDERED_NODE_ITERATOR_TYPE" type="short" value="4"/>
  59.   <var name="ORDERED_NODE_ITERATOR_TYPE"   type="short" value="5"/>
  60.   <var name="UNORDERED_NODE_SNAPSHOT_TYPE" type="short" value="6"/>
  61.   <var name="ORDERED_NODE_SNAPSHOT_TYPE"   type="short" value="7"/>
  62.   <var name="ANY_UNORDERED_NODE_TYPE"      type="short" value="8"/>
  63.   <var name="FIRST_ORDERED_NODE_TYPE"      type="short" value="9"/>
  64.  
  65.   <var name="booleanValue"                 type="boolean"/>
  66.   <var name="shortValue"                   type="short"/>
  67.   <var name="intValue"                     type="int"/>
  68.   <var name="doubleValue"                  type="double"/>
  69.   <var name="nodeValue"                    type="Node"/>
  70.   <var name="stringValue"                  type="DOMString"/>
  71.  
  72.   <var name="nodeTypeList"                 type="List">
  73.     <member type="short">0</member>
  74.     <member type="short">1</member>
  75.     <member type="short">2</member>
  76.     <member type="short">3</member>
  77.     <member type="short">4</member>
  78.     <member type="short">5</member>
  79.     <member type="short">6</member>
  80.     <member type="short">7</member>
  81.     <member type="short">8</member>
  82.     <member type="short">9</member>
  83.   </var>
  84.  
  85.   <load var="doc" href="staff" willBeModified="false"/>
  86.  
  87.   <createXPathEvaluator var="evaluator" document="doc"/>
  88.  
  89.   <createNSResolver obj="evaluator" var="resolver" nodeResolver="doc"/>
  90.  
  91.   <assign var="contextNode" value="doc"/>
  92.  
  93.   <for-each collection="nodeTypeList" member="inNodeType">
  94.  
  95.     <evaluate obj="evaluator"
  96.               var="outresult"
  97.               expression="expression"
  98.               contextNode="contextNode"
  99.               resolver="resolver"
  100.               type="inNodeType"
  101.               result="inresult"
  102.               interface="XPathEvaluator"
  103.         />
  104.  
  105.      <resultType obj="outresult"
  106.                  var="outNodeType"/>
  107.  
  108.      <if>
  109.        <equals expected="outNodeType" actual="NUMBER_TYPE"/>
  110.          <assertXPathException id="number_booleanValue_TYPE_ERR">
  111.            <TYPE_ERR>
  112.              <booleanValue obj="outresult"
  113.                            var="booleanValue"/>
  114.            </TYPE_ERR>
  115.          </assertXPathException>
  116.          <assertXPathException id="number_singleNodeValue_TYPE_ERR">
  117.            <TYPE_ERR>
  118.              <singleNodeValue obj="outresult"
  119.                            var="nodeValue"/>
  120.            </TYPE_ERR>
  121.          </assertXPathException>
  122.          <assertXPathException id="number_snapshotLength_TYPE_ERR">
  123.            <TYPE_ERR>
  124.              <snapshotLength obj="outresult"
  125.                            var="intValue"/>
  126.            </TYPE_ERR>
  127.          </assertXPathException>
  128.          <assertXPathException id="number_stringValue_TYPE_ERR">
  129.            <TYPE_ERR>
  130.              <stringValue obj="outresult"
  131.                            var="stringValue"/>
  132.            </TYPE_ERR>
  133.          </assertXPathException>
  134.          <assertXPathException id="number_iterateNext_TYPE_ERR">
  135.            <TYPE_ERR>
  136.              <iterateNext obj="outresult"
  137.                            var="nodeValue"/>
  138.            </TYPE_ERR>
  139.          </assertXPathException>
  140.          <assertXPathException id="number_snapshotItem_TYPE_ERR">
  141.            <TYPE_ERR>
  142.              <snapshotItem obj="outresult"
  143.                            var="nodeValue"
  144.                            index="0"/>
  145.            </TYPE_ERR>
  146.          </assertXPathException>
  147.      </if>
  148.      <if>
  149.        <equals expected="outNodeType" actual="STRING_TYPE"/>
  150.          <assertXPathException id="string_booleanValue_TYPE_ERR">
  151.            <TYPE_ERR>
  152.              <booleanValue obj="outresult"
  153.                            var="booleanValue"/>
  154.            </TYPE_ERR>
  155.          </assertXPathException>
  156.          <assertXPathException id="string_numberValue_TYPE_ERR">
  157.            <TYPE_ERR>
  158.              <numberValue obj="outresult"
  159.                            var="doubleValue"/>
  160.            </TYPE_ERR>
  161.          </assertXPathException>
  162.          <assertXPathException id="string_singleNodeValue_TYPE_ERR">
  163.            <TYPE_ERR>
  164.              <singleNodeValue obj="outresult"
  165.                            var="nodeValue"/>
  166.            </TYPE_ERR>
  167.          </assertXPathException>
  168.          <assertXPathException id="string_snapshotLength_TYPE_ERR">
  169.            <TYPE_ERR>
  170.              <snapshotLength obj="outresult"
  171.                            var="intValue"/>
  172.            </TYPE_ERR>
  173.          </assertXPathException>
  174.          <assertXPathException id="string_iterateNext_TYPE_ERR">
  175.            <TYPE_ERR>
  176.              <iterateNext obj="outresult"
  177.                            var="nodeValue"/>
  178.            </TYPE_ERR>
  179.          </assertXPathException>
  180.          <assertXPathException id="string_snapshotItem_TYPE_ERR">
  181.            <TYPE_ERR>
  182.              <snapshotItem obj="outresult"
  183.                            var="nodeValue"
  184.                            index="0"/>
  185.            </TYPE_ERR>
  186.          </assertXPathException>
  187.      </if>
  188.      <if>
  189.        <equals expected="outNodeType" actual="BOOLEAN_TYPE"/>
  190.          <assertXPathException id="boolean_numberValue_TYPE_ERR">
  191.            <TYPE_ERR>
  192.              <numberValue obj="outresult"
  193.                            var="doubleValue"/>
  194.            </TYPE_ERR>
  195.          </assertXPathException>
  196.          <assertXPathException id="boolean_singleNodeValue_TYPE_ERR">
  197.            <TYPE_ERR>
  198.              <singleNodeValue obj="outresult"
  199.                            var="nodeValue"/>
  200.            </TYPE_ERR>
  201.          </assertXPathException>
  202.          <assertXPathException id="boolean_snapshotLength_TYPE_ERR">
  203.            <TYPE_ERR>
  204.              <snapshotLength obj="outresult"
  205.                            var="intValue"/>
  206.            </TYPE_ERR>
  207.          </assertXPathException>
  208.          <assertXPathException id="boolean_stringValue_TYPE_ERR">
  209.            <TYPE_ERR>
  210.              <stringValue obj="outresult"
  211.                            var="stringValue"/>
  212.            </TYPE_ERR>
  213.          </assertXPathException>
  214.          <assertXPathException id="boolean_iterateNext_TYPE_ERR">
  215.            <TYPE_ERR>
  216.              <iterateNext obj="outresult"
  217.                            var="nodeValue"/>
  218.            </TYPE_ERR>
  219.          </assertXPathException>
  220.          <assertXPathException id="boolean_snapshotItem_TYPE_ERR">
  221.            <TYPE_ERR>
  222.              <snapshotItem obj="outresult"
  223.                            var="nodeValue"
  224.                            index="0"/>
  225.            </TYPE_ERR>
  226.          </assertXPathException>
  227.      </if>
  228.      <if>
  229.        <equals expected="outNodeType" actual="UNORDERED_NODE_ITERATOR_TYPE"/>
  230.          <assertXPathException id="unordered_node_iterator_booleanValue_TYPE_ERR">
  231.            <TYPE_ERR>
  232.              <booleanValue obj="outresult"
  233.                            var="booleanValue"/>
  234.            </TYPE_ERR>
  235.          </assertXPathException>
  236.          <assertXPathException id="unordered_node_iterator_numberValue_TYPE_ERR">
  237.            <TYPE_ERR>
  238.              <numberValue obj="outresult"
  239.                            var="doubleValue"/>
  240.            </TYPE_ERR>
  241.          </assertXPathException>
  242.          <assertXPathException id="unordered_node_iterator_singleNodeValue_TYPE_ERR">
  243.            <TYPE_ERR>
  244.              <singleNodeValue obj="outresult"
  245.                            var="nodeValue"/>
  246.            </TYPE_ERR>
  247.          </assertXPathException>
  248.          <assertXPathException id="unordered_node_iterator_snapshotLength_TYPE_ERR">
  249.            <TYPE_ERR>
  250.              <snapshotLength obj="outresult"
  251.                            var="intValue"/>
  252.            </TYPE_ERR>
  253.          </assertXPathException>
  254.          <assertXPathException id="unordered_node_iterator_stringValue_TYPE_ERR">
  255.            <TYPE_ERR>
  256.              <stringValue obj="outresult"
  257.                            var="stringValue"/>
  258.            </TYPE_ERR>
  259.          </assertXPathException>
  260.          <assertXPathException id="unordered_node_iterator_snapshotItem_TYPE_ERR">
  261.            <TYPE_ERR>
  262.              <snapshotItem obj="outresult"
  263.                            var="nodeValue"
  264.                            index="0"/>
  265.            </TYPE_ERR>
  266.          </assertXPathException>
  267.      </if>
  268.      <if>
  269.        <equals expected="outNodeType" actual="ORDERED_NODE_ITERATOR_TYPE"/>
  270.          <assertXPathException id="ordered_node_iterator_booleanValue_TYPE_ERR">
  271.            <TYPE_ERR>
  272.              <booleanValue obj="outresult"
  273.                            var="booleanValue"/>
  274.            </TYPE_ERR>
  275.          </assertXPathException>
  276.          <assertXPathException id="ordered_node_iterator_numberValue_TYPE_ERR">
  277.            <TYPE_ERR>
  278.              <numberValue obj="outresult"
  279.                            var="doubleValue"/>
  280.            </TYPE_ERR>
  281.          </assertXPathException>
  282.          <assertXPathException id="ordered_node_iterator_singleNodeValue_TYPE_ERR">
  283.            <TYPE_ERR>
  284.              <singleNodeValue obj="outresult"
  285.                            var="nodeValue"/>
  286.            </TYPE_ERR>
  287.          </assertXPathException>
  288.          <assertXPathException id="ordered_node_iterator_snapshotLength_TYPE_ERR">
  289.            <TYPE_ERR>
  290.              <snapshotLength obj="outresult"
  291.                            var="intValue"/>
  292.            </TYPE_ERR>
  293.          </assertXPathException>
  294.          <assertXPathException id="ordered_node_iterator_stringValue_TYPE_ERR">
  295.            <TYPE_ERR>
  296.              <stringValue obj="outresult"
  297.                            var="stringValue"/>
  298.            </TYPE_ERR>
  299.          </assertXPathException>
  300.          <assertXPathException id="ordered_node_iterator_snapshotItem_TYPE_ERR">
  301.            <TYPE_ERR>
  302.              <snapshotItem obj="outresult"
  303.                            var="nodeValue"
  304.                            index="0"/>
  305.            </TYPE_ERR>
  306.          </assertXPathException>
  307.      </if>
  308.      <if>
  309.        <equals expected="outNodeType" actual="UNORDERED_NODE_SNAPSHOT_TYPE"/>
  310.          <assertXPathException id="unordered_node_snapshot_booleanValue_TYPE_ERR">
  311.            <TYPE_ERR>
  312.              <booleanValue obj="outresult"
  313.                            var="booleanValue"/>
  314.            </TYPE_ERR>
  315.          </assertXPathException>
  316.          <assertXPathException id="unordered_node_snapshot_numberValue_TYPE_ERR">
  317.            <TYPE_ERR>
  318.              <numberValue obj="outresult"
  319.                            var="doubleValue"/>
  320.            </TYPE_ERR>
  321.          </assertXPathException>
  322.          <assertXPathException id="unordered_node_snapshot_singleNodeValue_TYPE_ERR">
  323.            <TYPE_ERR>
  324.              <singleNodeValue obj="outresult"
  325.                            var="nodeValue"/>
  326.            </TYPE_ERR>
  327.          </assertXPathException>
  328.          <assertXPathException id="unordered_node_snapshot_stringValue_TYPE_ERR">
  329.            <TYPE_ERR>
  330.              <stringValue obj="outresult"
  331.                            var="stringValue"/>
  332.            </TYPE_ERR>
  333.          </assertXPathException>
  334.          <assertXPathException id="unordered_node_snapshot_iterateNext_TYPE_ERR">
  335.            <TYPE_ERR>
  336.              <iterateNext obj="outresult"
  337.                            var="nodeValue"/>
  338.            </TYPE_ERR>
  339.          </assertXPathException>
  340.      </if>
  341.      <if>
  342.        <equals expected="outNodeType" actual="ORDERED_NODE_SNAPSHOT_TYPE"/>
  343.          <assertXPathException id="ordered_node_snapshot_booleanValue_TYPE_ERR">
  344.            <TYPE_ERR>
  345.              <booleanValue obj="outresult"
  346.                            var="booleanValue"/>
  347.            </TYPE_ERR>
  348.          </assertXPathException>
  349.          <assertXPathException id="ordered_node_snapshot_numberValue_TYPE_ERR">
  350.            <TYPE_ERR>
  351.              <numberValue obj="outresult"
  352.                            var="doubleValue"/>
  353.            </TYPE_ERR>
  354.          </assertXPathException>
  355.          <assertXPathException id="ordered_node_snapshot_singleNodeValue_TYPE_ERR">
  356.            <TYPE_ERR>
  357.              <singleNodeValue obj="outresult"
  358.                            var="nodeValue"/>
  359.            </TYPE_ERR>
  360.          </assertXPathException>
  361.          <assertXPathException id="ordered_node_snapshot_stringValue_TYPE_ERR">
  362.            <TYPE_ERR>
  363.              <stringValue obj="outresult"
  364.                            var="stringValue"/>
  365.            </TYPE_ERR>
  366.          </assertXPathException>
  367.          <assertXPathException id="ordered_node_snapshot_iterateNext_TYPE_ERR">
  368.            <TYPE_ERR>
  369.              <iterateNext obj="outresult"
  370.                            var="nodeValue"/>
  371.            </TYPE_ERR>
  372.          </assertXPathException>
  373.      </if>
  374.      <if>
  375.        <equals expected="outNodeType" actual="ANY_UNORDERED_NODE_TYPE"/>
  376.          <assertXPathException id="any_unordered_node_booleanValue_TYPE_ERR">
  377.            <TYPE_ERR>
  378.              <booleanValue obj="outresult"
  379.                            var="booleanValue"/>
  380.            </TYPE_ERR>
  381.          </assertXPathException>
  382.          <assertXPathException id="any_unordered_node_numberValue_TYPE_ERR">
  383.            <TYPE_ERR>
  384.              <numberValue obj="outresult"
  385.                            var="doubleValue"/>
  386.            </TYPE_ERR>
  387.          </assertXPathException>
  388.          <assertXPathException id="any_unordered_node_snapshotLength_TYPE_ERR">
  389.            <TYPE_ERR>
  390.              <snapshotLength obj="outresult"
  391.                            var="intValue"/>
  392.            </TYPE_ERR>
  393.          </assertXPathException>
  394.          <assertXPathException id="any_unordered_node_stringValue_TYPE_ERR">
  395.            <TYPE_ERR>
  396.              <stringValue obj="outresult"
  397.                            var="stringValue"/>
  398.            </TYPE_ERR>
  399.          </assertXPathException>
  400.          <assertXPathException id="any_unordered_node_iterateNext_TYPE_ERR">
  401.            <TYPE_ERR>
  402.              <iterateNext obj="outresult"
  403.                            var="nodeValue"/>
  404.            </TYPE_ERR>
  405.          </assertXPathException>
  406.          <assertXPathException id="any_unordered_node_snapshotItem_TYPE_ERR">
  407.            <TYPE_ERR>
  408.              <snapshotItem obj="outresult"
  409.                            var="nodeValue"
  410.                            index="0"/>
  411.            </TYPE_ERR>
  412.          </assertXPathException>
  413.      </if>
  414.      <if>
  415.        <equals expected="outNodeType" actual="FIRST_ORDERED_NODE_TYPE"/>
  416.          <assertXPathException id="first_ordered_node_booleanValue_TYPE_ERR">
  417.            <TYPE_ERR>
  418.              <booleanValue obj="outresult"
  419.                            var="booleanValue"/>
  420.            </TYPE_ERR>
  421.          </assertXPathException>
  422.          <assertXPathException id="first_ordered_node_numberValue_TYPE_ERR">
  423.            <TYPE_ERR>
  424.              <numberValue obj="outresult"
  425.                            var="doubleValue"/>
  426.            </TYPE_ERR>
  427.          </assertXPathException>
  428.          <assertXPathException id="first_ordered_node_snapshotLength_TYPE_ERR">
  429.            <TYPE_ERR>
  430.              <snapshotLength obj="outresult"
  431.                            var="intValue"/>
  432.            </TYPE_ERR>
  433.          </assertXPathException>
  434.          <assertXPathException id="first_ordered_node_stringValue_TYPE_ERR">
  435.            <TYPE_ERR>
  436.              <stringValue obj="outresult"
  437.                            var="stringValue"/>
  438.            </TYPE_ERR>
  439.          </assertXPathException>
  440.          <assertXPathException id="first_ordered_node_iterateNext_TYPE_ERR">
  441.            <TYPE_ERR>
  442.              <iterateNext obj="outresult"
  443.                            var="nodeValue"/>
  444.            </TYPE_ERR>
  445.          </assertXPathException>
  446.          <assertXPathException id="first_ordered_node_snapshotItem_TYPE_ERR">
  447.            <TYPE_ERR>
  448.              <snapshotItem obj="outresult"
  449.                            var="nodeValue"
  450.                            index="0"/>
  451.            </TYPE_ERR>
  452.          </assertXPathException>
  453.      </if>
  454.  
  455.    </for-each>
  456.  
  457. </test>
  458.