diff options
Diffstat (limited to 'test/testcases/tests/level3/xpath/Conformance_Expressions.xml')
-rw-r--r-- | test/testcases/tests/level3/xpath/Conformance_Expressions.xml | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/test/testcases/tests/level3/xpath/Conformance_Expressions.xml b/test/testcases/tests/level3/xpath/Conformance_Expressions.xml new file mode 100644 index 0000000..d3d1f38 --- /dev/null +++ b/test/testcases/tests/level3/xpath/Conformance_Expressions.xml @@ -0,0 +1,280 @@ +<?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="Conformance_Expressions"> + <metadata> + <title>Conformance_Expressions</title> + <creator>Bob Clary</creator> + <description> + 1.3 Conformance - Iterate over a list of strings containing + valid XPath expressions, calling XPathEvaluator.createExpression + for each. If no expections are thrown and each result is non-null, + then the test passes. + </description> + <date qualifier="created">2003-11-18</date> + <subject resource="&spec;#Conformance"/> + <subject resource="&spec;#XPathEvaluator"/> + <subject resource="&spec;#XPathEvaluator-createNSResolver"/> + <subject resource="&spec;#XPathEvaluator-createExpression"/> + <subject resource="&spec;#XPathNSResolver"/> + </metadata> + + <!-- Standard Variables --> + + <var name="doc" type="Document"/> + <var name="resolver" type="XPathNSResolver"/> + <var name="evaluator" type="XPathEvaluator"/> + + <!-- Inputs --> + + <var name="expression" type="DOMString"/> + + <!-- Test Variables --> + + <var name="expressionList" type="List"/> + <var name="xpathexpression" type="XPathExpression"/> + + <load var="doc" href="staffNS" willBeModified="false"/> + + <createXPathEvaluator var='evaluator' document='doc'/> + + <createNSResolver var="resolver" obj="evaluator" nodeResolver="doc"/> + + <!-- test root absolute expression --> + <append collection="expressionList" item=""/""/> + + <!-- test verbose axes and basic node tests --> + <append collection="expressionList" item=""child::comment()""/> + <append collection="expressionList" item=""child::text()""/> + <append collection="expressionList" item=""child::processing-instruction()""/> + <append collection="expressionList" item=""child::processing-instruction('name')""/> + <append collection="expressionList" item=""child::node()""/> + <append collection="expressionList" item=""child::*""/> + <append collection="expressionList" item=""child::nist:*""/> + <append collection="expressionList" item=""child::employee""/> + + <append collection="expressionList" item=""descendant::comment()""/> + <append collection="expressionList" item=""descendant::text()""/> + <append collection="expressionList" item=""descendant::processing-instruction()""/> + <append collection="expressionList" item=""descendant::processing-instruction('name')""/> + <append collection="expressionList" item=""descendant::node()""/> + <append collection="expressionList" item=""descendant::*""/> + <append collection="expressionList" item=""descendant::nist:*""/> + <append collection="expressionList" item=""descendant::employee""/> + + <append collection="expressionList" item=""parent::comment()""/> + <append collection="expressionList" item=""parent::text()""/> + <append collection="expressionList" item=""parent::processing-instruction()""/> + <append collection="expressionList" item=""parent::processing-instruction('name')""/> + <append collection="expressionList" item=""parent::node()""/> + <append collection="expressionList" item=""parent::*""/> + <append collection="expressionList" item=""parent::nist:*""/> + <append collection="expressionList" item=""parent::employee""/> + + <append collection="expressionList" item=""ancestor::comment()""/> + <append collection="expressionList" item=""ancestor::text()""/> + <append collection="expressionList" item=""ancestor::processing-instruction()""/> + <append collection="expressionList" item=""ancestor::processing-instruction('name')""/> + <append collection="expressionList" item=""ancestor::node()""/> + <append collection="expressionList" item=""ancestor::*""/> + <append collection="expressionList" item=""ancestor::nist:*""/> + <append collection="expressionList" item=""ancestor::employee""/> + + <append collection="expressionList" item=""following-sibling::comment()""/> + <append collection="expressionList" item=""following-sibling::text()""/> + <append collection="expressionList" item=""following-sibling::processing-instruction()""/> + <append collection="expressionList" item=""following-sibling::processing-instruction('name')""/> + <append collection="expressionList" item=""following-sibling::node()""/> + <append collection="expressionList" item=""following-sibling::*""/> + <append collection="expressionList" item=""following-sibling::nist:*""/> + <append collection="expressionList" item=""following-sibling::employee""/> + + <append collection="expressionList" item=""preceding-sibling::comment()""/> + <append collection="expressionList" item=""preceding-sibling::text()""/> + <append collection="expressionList" item=""preceding-sibling::processing-instruction()""/> + <append collection="expressionList" item=""preceding-sibling::processing-instruction('name')""/> + <append collection="expressionList" item=""preceding-sibling::node()""/> + <append collection="expressionList" item=""preceding-sibling::*""/> + <append collection="expressionList" item=""preceding-sibling::nist:*""/> + <append collection="expressionList" item=""preceding-sibling::employee""/> + + <append collection="expressionList" item=""following::comment()""/> + <append collection="expressionList" item=""following::text()""/> + <append collection="expressionList" item=""following::processing-instruction()""/> + <append collection="expressionList" item=""following::processing-instruction('name')""/> + <append collection="expressionList" item=""following::node()""/> + <append collection="expressionList" item=""following::*""/> + <append collection="expressionList" item=""following::nist:*""/> + <append collection="expressionList" item=""following::employee""/> + + <append collection="expressionList" item=""preceding::comment()""/> + <append collection="expressionList" item=""preceding::text()""/> + <append collection="expressionList" item=""preceding::processing-instruction()""/> + <append collection="expressionList" item=""preceding::processing-instruction('name')""/> + <append collection="expressionList" item=""preceding::node()""/> + <append collection="expressionList" item=""preceding::*""/> + <append collection="expressionList" item=""preceding::nist:*""/> + <append collection="expressionList" item=""preceding::employee""/> + + <append collection="expressionList" item=""attribute::comment()""/> + <append collection="expressionList" item=""attribute::text()""/> + <append collection="expressionList" item=""attribute::processing-instruction()""/> + <append collection="expressionList" item=""attribute::processing-instruction('name')""/> + <append collection="expressionList" item=""attribute::node()""/> + <append collection="expressionList" item=""attribute::*""/> + <append collection="expressionList" item=""attribute::nist:*""/> + <append collection="expressionList" item=""attribute::employee""/> + + <append collection="expressionList" item=""namespace::comment()""/> + <append collection="expressionList" item=""namespace::text()""/> + <append collection="expressionList" item=""namespace::processing-instruction()""/> + <append collection="expressionList" item=""namespace::processing-instruction('name')""/> + <append collection="expressionList" item=""namespace::node()""/> + <append collection="expressionList" item=""namespace::*""/> + <append collection="expressionList" item=""namespace::nist:*""/> + <append collection="expressionList" item=""namespace::employee""/> + + <append collection="expressionList" item=""self::comment()""/> + <append collection="expressionList" item=""self::text()""/> + <append collection="expressionList" item=""self::processing-instruction()""/> + <append collection="expressionList" item=""self::processing-instruction('name')""/> + <append collection="expressionList" item=""self::node()""/> + <append collection="expressionList" item=""self::*""/> + <append collection="expressionList" item=""self::nist:*""/> + <append collection="expressionList" item=""self::employee""/> + + <append collection="expressionList" item=""descendant-or-self::comment()""/> + <append collection="expressionList" item=""descendant-or-self::text()""/> + <append collection="expressionList" item=""descendant-or-self::processing-instruction()""/> + <append collection="expressionList" item=""descendant-or-self::processing-instruction('name')""/> + <append collection="expressionList" item=""descendant-or-self::node()""/> + <append collection="expressionList" item=""descendant-or-self::*""/> + <append collection="expressionList" item=""descendant-or-self::nist:*""/> + <append collection="expressionList" item=""descendant-or-self::employee""/> + + <append collection="expressionList" item=""ancestor-or-self::comment()""/> + <append collection="expressionList" item=""ancestor-or-self::text()""/> + <append collection="expressionList" item=""ancestor-or-self::processing-instruction()""/> + <append collection="expressionList" item=""ancestor-or-self::processing-instruction('name')""/> + <append collection="expressionList" item=""ancestor-or-self::node()""/> + <append collection="expressionList" item=""ancestor-or-self::*""/> + <append collection="expressionList" item=""ancestor-or-self::nist:*""/> + <append collection="expressionList" item=""ancestor-or-self::employee""/> + + <!-- test common abbreviations --> + <append collection="expressionList" item=""comment()""/> + <append collection="expressionList" item=""text()""/> + <append collection="expressionList" item=""processing-instruction()""/> + <append collection="expressionList" item=""processing-instruction('name')""/> + <append collection="expressionList" item=""node()""/> + <append collection="expressionList" item=""*""/> + <append collection="expressionList" item=""nist:*""/> + <append collection="expressionList" item=""employee""/> + + <append collection="expressionList" item="".//comment()""/> + <append collection="expressionList" item="".//text()""/> + <append collection="expressionList" item="".//processing-instruction()""/> + <append collection="expressionList" item="".//processing-instruction('name')""/> + <append collection="expressionList" item="".//node()""/> + <append collection="expressionList" item="".//*""/> + <append collection="expressionList" item="".//nist:*""/> + <append collection="expressionList" item="".//employee""/> + + <append collection="expressionList" item=""../comment()""/> + <append collection="expressionList" item=""../text()""/> + <append collection="expressionList" item=""../processing-instruction()""/> + <append collection="expressionList" item=""../processing-instruction('name')""/> + <append collection="expressionList" item=""../node()""/> + <append collection="expressionList" item=""../*""/> + <append collection="expressionList" item=""../nist:*""/> + <append collection="expressionList" item=""../employee""/> + + <append collection="expressionList" item=""@attributename""/> + + <append collection="expressionList" item=""./comment()""/> + <append collection="expressionList" item=""./text()""/> + <append collection="expressionList" item=""./processing-instruction()""/> + <append collection="expressionList" item=""./processing-instruction('name')""/> + <append collection="expressionList" item=""./node()""/> + <append collection="expressionList" item=""./*""/> + <append collection="expressionList" item=""./nist:*""/> + <append collection="expressionList" item=""./employee""/> + + <!-- test Union --> + <append collection="expressionList" item=""comment() | text() | processing-instruction() | node()""/> + + <!-- test various predicates --> + + <append collection="expressionList" item=""employee[address]""/> + <append collection="expressionList" item=""employee/address[@street]""/> + <append collection="expressionList" item=""employee[position='Computer Specialist']""/> + <append collection="expressionList" item=""employee[position!='Computer Specialist']""/> + <append collection="expressionList" item=""employee[gender='Male' or gender='Female']""/> + <append collection="expressionList" item=""employee[gender!='Male' and gender!='Female']""/> + <append collection="expressionList" item=""employee/address[@street='Yes']""/> + <append collection="expressionList" item=""employee/address[@street!='Yes']""/> + <append collection="expressionList" item=""employee[position()=1]""/> + <append collection="expressionList" item=""employee[1]""/> + <append collection="expressionList" item=""employee[position()=last()]""/> + <append collection="expressionList" item=""employee[last()]""/> + <append collection="expressionList" item=""employee[position()>1 and position<last()]""/> + <append collection="expressionList" item=""employee[position()>=1 and position<=last()]""/> + <append collection="expressionList" item=""employee[count(.)>0]""/> + <append collection="expressionList" item=""employee[position() mod 2=0]""/> + <append collection="expressionList" item=""employee[position() mod -2=0]""/> + <append collection="expressionList" item=""employee[position() div 2=0]""/> + <append collection="expressionList" item=""employee[position() div -2=-1]""/> + <append collection="expressionList" item=""employee[position() div 2 * 2=position()]""/> + <append collection="expressionList" item=""employee[3 > 2 > 1]""/> + <append collection="expressionList" item=""id('CANADA')""/> + <append collection="expressionList" item=""*[local-name()='employee']""/> + <append collection="expressionList" item=""*[local-name(.)='employee']""/> + <append collection="expressionList" item=""*[local-name(employee)='employee']""/> + <append collection="expressionList" item=""*[local-name()='employee']""/> + <append collection="expressionList" item=""*[namespace-uri()='http://www.nist.gov']""/> + <append collection="expressionList" item=""*[name()='nist:employee']""/> + <append collection="expressionList" item=""*[string()]""/> + <append collection="expressionList" item=""*[string(10 div foo)='NaN']""/> + <append collection="expressionList" item=""*[concat('a', 'b', 'c')]""/> + <append collection="expressionList" item=""*[starts-with('employee', 'emp')]""/> + <append collection="expressionList" item=""*[contains('employee', 'emp')]""/> + <append collection="expressionList" item=""*[substring-before('employeeId', 'Id')]""/> + <append collection="expressionList" item=""*[substring-after('employeeId', 'employee')]""/> + <append collection="expressionList" item=""*[substring('employeeId', 4)]""/> + <append collection="expressionList" item=""*[substring('employeeId', 4, 5)]""/> + <append collection="expressionList" item=""*[string-length()=2]""/> + <append collection="expressionList" item=""*[string-length(.)=string-length(normalize-space(.))]""/> + <append collection="expressionList" item=""*[translate('bar', 'abc', 'ABC')='BAr']""/> + <append collection="expressionList" item=""*[boolean(.)]""/> + <append collection="expressionList" item=""*[not(boolean(.))]""/> + <append collection="expressionList" item=""*[true()]""/> + <append collection="expressionList" item=""*[false()]""/> + <append collection="expressionList" item=""*[lang('en')]""/> + <append collection="expressionList" item=""*[number()]""/> + <append collection="expressionList" item=""*[number('4')]""/> + <append collection="expressionList" item=""*[floor(.)]>0""/> + <append collection="expressionList" item=""*[ceiling(.)]<1""/> + <append collection="expressionList" item=""*[round(number(.))=0]<1""/> + + <for-each collection="expressionList" member="expression"> + <createExpression var="xpathexpression" + obj="evaluator" + resolver="resolver" + expression="expression"/> + </for-each> +</test> |