diff options
Diffstat (limited to 'test/testcases/tests/level3/xpath/XPathResult_TYPE_ERR.xml')
-rw-r--r-- | test/testcases/tests/level3/xpath/XPathResult_TYPE_ERR.xml | 457 |
1 files changed, 457 insertions, 0 deletions
diff --git a/test/testcases/tests/level3/xpath/XPathResult_TYPE_ERR.xml b/test/testcases/tests/level3/xpath/XPathResult_TYPE_ERR.xml new file mode 100644 index 0000000..29cae68 --- /dev/null +++ b/test/testcases/tests/level3/xpath/XPathResult_TYPE_ERR.xml @@ -0,0 +1,457 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> +<!-- + Copyright (c) 2003 World Wide Web Consortium, + + (Massachusetts Institute of Technology, European Research Consortium for + Informatics and Mathematics, Keio University). All Rights Reserved. This + work is distributed under the W3C(r) Software License [1] in the hope that + it will be useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +--> + +<!DOCTYPE test SYSTEM "dom3.dtd" [ + <!ENTITY % entities SYSTEM "dom3xpathents.ent"> + %entities; +]> +<test xmlns="&level3;" name="XPathResult_TYPE_ERR"> + <metadata> + <title>XPathResult_TYPE_ERR</title> + <creator>Bob Clary</creator> + <description> + Create an XPathResult for the expression /staff/employee + for each type of XPathResultType, checking that TYPE_ERR + is thrown when inappropriate properties and methods are accessed. + </description> + <date qualifier="created">2003-12-02</date> + <subject resource="&spec;#TYPE_ERR"/> + <subject resource="&spec;#XPathException"/> + <subject resource="&spec;#XPathResult"/> + <subject resource="&spec;#XPathResultType"/> + <subject resource="&spec;#XPathEvaluator-createNSResolver"/> + <subject resource="&spec;#XPathResult-resultType"/> + <subject resource="&spec;#XPathResult-booleanValue"/> + <subject resource="&spec;#XPathResult-numberValue"/> + <subject resource="&spec;#XPathResult-singleNodeValue"/> + <subject resource="&spec;#XPathResult-snapshot-length"/> + <subject resource="&spec;#XPathResult-stringValue"/> + <subject resource="&spec;#XPathResult-iterateNext"/> + <subject resource="&spec;#XPathResult-snapshotItem"/> + </metadata> + + <var name="doc" type="Document"/> + <var name="resolver" type="XPathNSResolver"/> + <var name="evaluator" type="XPathEvaluator"/> + <var name="expression" type="DOMString" + value=""/staff/employee""/> + <var name="contextNode" type="Node"/> + <var name="inresult" type="XPathResult" isNull="true"/> + <var name="outresult" type="XPathResult" isNull="true"/> + <var name="inNodeType" type="short"/> + <var name="outNodeType" type="short"/> + <var name="ANY_TYPE" type="short" value="0"/> + <var name="NUMBER_TYPE" type="short" value="1"/> + <var name="STRING_TYPE" type="short" value="2"/> + <var name="BOOLEAN_TYPE" type="short" value="3"/> + <var name="UNORDERED_NODE_ITERATOR_TYPE" type="short" value="4"/> + <var name="ORDERED_NODE_ITERATOR_TYPE" type="short" value="5"/> + <var name="UNORDERED_NODE_SNAPSHOT_TYPE" type="short" value="6"/> + <var name="ORDERED_NODE_SNAPSHOT_TYPE" type="short" value="7"/> + <var name="ANY_UNORDERED_NODE_TYPE" type="short" value="8"/> + <var name="FIRST_ORDERED_NODE_TYPE" type="short" value="9"/> + + <var name="booleanValue" type="boolean"/> + <var name="shortValue" type="short"/> + <var name="intValue" type="int"/> + <var name="doubleValue" type="double"/> + <var name="nodeValue" type="Node"/> + <var name="stringValue" type="DOMString"/> + + <var name="nodeTypeList" type="List"> + <member type="short">0</member> + <member type="short">1</member> + <member type="short">2</member> + <member type="short">3</member> + <member type="short">4</member> + <member type="short">5</member> + <member type="short">6</member> + <member type="short">7</member> + <member type="short">8</member> + <member type="short">9</member> + </var> + + <load var="doc" href="staff" willBeModified="false"/> + + <createXPathEvaluator var="evaluator" document="doc"/> + + <createNSResolver obj="evaluator" var="resolver" nodeResolver="doc"/> + + <assign var="contextNode" value="doc"/> + + <for-each collection="nodeTypeList" member="inNodeType"> + + <evaluate obj="evaluator" + var="outresult" + expression="expression" + contextNode="contextNode" + resolver="resolver" + type="inNodeType" + result="inresult" + interface="XPathEvaluator" + /> + + <resultType obj="outresult" + var="outNodeType"/> + + <if> + <equals expected="outNodeType" actual="NUMBER_TYPE"/> + <assertXPathException id="number_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="number_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="number_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="number_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="number_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="number_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="STRING_TYPE"/> + <assertXPathException id="string_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="string_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="string_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="string_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="string_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="string_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="BOOLEAN_TYPE"/> + <assertXPathException id="boolean_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="boolean_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="boolean_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="boolean_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="boolean_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="boolean_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="UNORDERED_NODE_ITERATOR_TYPE"/> + <assertXPathException id="unordered_node_iterator_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_iterator_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_iterator_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_iterator_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_iterator_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_iterator_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="ORDERED_NODE_ITERATOR_TYPE"/> + <assertXPathException id="ordered_node_iterator_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_iterator_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_iterator_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_iterator_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_iterator_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_iterator_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="UNORDERED_NODE_SNAPSHOT_TYPE"/> + <assertXPathException id="unordered_node_snapshot_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_snapshot_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_snapshot_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_snapshot_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="unordered_node_snapshot_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="ORDERED_NODE_SNAPSHOT_TYPE"/> + <assertXPathException id="ordered_node_snapshot_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_snapshot_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_snapshot_singleNodeValue_TYPE_ERR"> + <TYPE_ERR> + <singleNodeValue obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_snapshot_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="ordered_node_snapshot_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="ANY_UNORDERED_NODE_TYPE"/> + <assertXPathException id="any_unordered_node_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="any_unordered_node_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="any_unordered_node_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="any_unordered_node_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="any_unordered_node_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="any_unordered_node_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + <if> + <equals expected="outNodeType" actual="FIRST_ORDERED_NODE_TYPE"/> + <assertXPathException id="first_ordered_node_booleanValue_TYPE_ERR"> + <TYPE_ERR> + <booleanValue obj="outresult" + var="booleanValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="first_ordered_node_numberValue_TYPE_ERR"> + <TYPE_ERR> + <numberValue obj="outresult" + var="doubleValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="first_ordered_node_snapshotLength_TYPE_ERR"> + <TYPE_ERR> + <snapshotLength obj="outresult" + var="intValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="first_ordered_node_stringValue_TYPE_ERR"> + <TYPE_ERR> + <stringValue obj="outresult" + var="stringValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="first_ordered_node_iterateNext_TYPE_ERR"> + <TYPE_ERR> + <iterateNext obj="outresult" + var="nodeValue"/> + </TYPE_ERR> + </assertXPathException> + <assertXPathException id="first_ordered_node_snapshotItem_TYPE_ERR"> + <TYPE_ERR> + <snapshotItem obj="outresult" + var="nodeValue" + index="0"/> + </TYPE_ERR> + </assertXPathException> + </if> + + </for-each> + +</test> |