You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/07/11 22:44:14 UTC

svn commit: r210210 [3/4] - in /webservices/axis/trunk/java/modules/xml: ./ test-resources/xml/ test-resources/xml/test/ test/org/apache/axis2/xpath/

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/much_ado.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/namespaces.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/namespaces.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/namespaces.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/namespaces.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<foo:a xmlns:foo="http://fooNamespace/">
+  <b>
+    <c>Hello</c>
+  </b>
+
+  <foo:d>
+    <foo:e>Hey</foo:e>
+  </foo:d>
+
+  <bar:f xmlns:bar="http://barNamespace/">
+    <bar:g>Hey2</bar:g>
+  </bar:f>
+
+  <alias:x xmlns:alias="http://fooNamespace/">
+    <alias:y>Hey3</alias:y>
+  </alias:x>
+</foo:a>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/namespaces.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/nitf.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/nitf.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/nitf.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/nitf.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nitf>
+
+  <!-- Example of markup of URLs (at the bottom of the story) -->
+
+ <head>
+  <meta name="ap-cycle" content="AP"/>
+  <meta name="ap-online-code" content="1700"/>
+  <meta name="ap-company" content="CO:Media Metrix Inc;TS:MMXI;IG:SVC;"/>
+  <meta name="ap-routing" content="ENTITLEMENTS,pfONLINE,pf1700"/>
+  <meta name="ap-format" content="bx"/>
+  <meta name="ap-category" content="f"/>
+  <meta name="ap-selector" content="-----"/>
+  <meta name="ap-transref" content="V0347"/>
+  <docdata>
+   <doc-id regsrc="AP" id-string="D76UIMO80"/>
+   <urgency ed-urg="7"/>
+   <date.issue norm="20000911T185842Z"/>
+   <du-key key="Napster Traffic"/>
+   <doc.copyright holder="(AP)"/>
+  </docdata>
+ </head>
+ <body>
+  <body.head>
+   <hedline>
+    <hl1>Use of Napster Quadruples</hl1>
+   </hedline>
+   <byline>By PETER SVENSSON
+    <byttl>AP Business Writer</byttl>
+   </byline>
+   <distributor>The Associated Press</distributor>
+   <dateline>
+    <location>NEW YORK</location>
+   </dateline>
+  </body.head>
+  <body.content>
+   <block>
+    <p>Despite the uncertain legality of the Napster online music-sharing service, the number of people
+using it more than quadrupled in just five months, Media Metrix said Monday.</p>
+    <p>That made Napster the fastest-growing software application ever recorded by the Internet research
+company.</p>
+    <p>From 1.1 million home users in the United States in February, the first month Media Metrix
+tracked the application, Napster use rocketed to 4.9 million users in July.</p>
+    <p>That represents 6 percent of U.S. home PC users who have modems, said Media Metrix, which pays
+people to install monitoring software on their computers.</p>
+    <p>It estimates total usage from a panel of about 50,000 people in the United States.</p>
+    <p>Napster was also used at work by 887,000 people in July, Media Metrix said.</p>
+    <p>Napster Inc. has been sued by the recording industry for allegedly enabling copyright
+infringement. The federal government weighed in on the case Friday, saying the service is not protected
+under a key copyright law, as the San Mateo, Calif., company claims.</p>
+    <p>Bruce Ryon, head of Media Metrix&apos;s New Media Group, said Napster was used by &quot;the full spectrum of PC users, not just the youth with time on their hands and a passion for music.&quot;</p>
+    <p>The Napster program allows users to copy digital music files from the hard drives of other
+users over the Internet.</p>
+    <p>Napster Inc. said last week that 28 million people had downloaded its program. It does not reveal
+its own figures for how many people actually use the software.</p>
+    <p>Because the program connects to the company&apos;s computers over the Internet every time
+it is run, Napster Inc. can track usage exactly.</p>
+    <p>__</p>
+    <p>On the Net:</p>
+    <p><a href="http://www.napster.com">
+http://www.napster.com</a></p>
+    <p><a href="http://www.mediametrix.com">
+http://www.mediametrix.com</a></p>
+   </block>
+  </body.content>
+ </body>
+</nitf>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/nitf.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/numbers.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/numbers.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/numbers.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/numbers.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+
+<numbers>
+  <set>
+    <nr>3</nr>
+    <nr>24</nr>
+    <nr>55</nr>
+    <nr>11</nr>
+    <nr>2</nr>
+    <nr>-3</nr>
+  </set>
+  <set>
+    <nr value="66"/>
+    <nr value="123"/>
+    <nr value="55"/>
+    <nr value="9999"/>
+  </set>
+</numbers>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/numbers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/pi.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/pi.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/pi.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/pi.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<foo>
+	<?cheese is tasty?>
+	<bar>
+		<baz/>
+		<cheese/>
+		<baz/>
+		<?toast is tasty?>
+		<cheese/>
+		<baz/>
+	</bar>
+	<?cheese is gooey?>
+</foo>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/pi.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/pi2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/pi2.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/pi2.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/pi2.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<a>
+  <b>foo</b>
+  <?toc order-by="x"?>
+  <c>bar</c>
+</a>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/pi2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/simple.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/simple.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/simple.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/simple.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<root><a>a</a><b>b</b><c><d>d</d></c></root>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/simple.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,685 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tests xmlns:var="http://jaxen.org/test-harness/var">
+    <!-- test for jaxen-24 -->
+   <document url="xml/jaxen24.xml">
+       <context select="/body/div">
+           <test select="preceding::*[1]" count="1"/>
+           <valueOf select="local-name(preceding::*[1])">span</valueOf>
+       </context>
+        <!-- jaxen-58 -->
+       <context select="/">
+           <test select="//preceding::x" count="0"/>
+           <test select="//following::x" count="0"/>
+           <test select="/descendant::*/preceding::x" count="0"/>
+           <test select="/descendant::node()/preceding::x" count="0"/>
+       </context>
+   </document>
+
+    <!-- test for jaxen-3 -->
+  <document url="xml/simple.xml">
+    <context select="/">
+      <valueOf select="string()">abd</valueOf>
+    </context>
+    <context select="/root">
+      <valueOf select="string()">abd</valueOf>
+    </context>
+    <context select="/root/a">
+      <valueOf select="string()">a</valueOf>
+    </context>
+    <context select="/root/c">
+      <valueOf select="string()">d</valueOf>
+    </context>
+  </document>
+
+
+    <!-- test for jaxen-3 -->
+  <document url="xml/jaxen3.xml">
+    <context select="/">
+      <test select="/Configuration/hostname/attrlist/hostname[. = 'CE-A'] " count="1"/>
+    </context>
+  </document>
+
+    <!-- parser test cases all of which should fail-->
+  <document url="xml/numbers.xml">
+    <context select="/">
+        <!-- repeated xpaths, jaxen-35 -->
+      <test exception="true" select="/numbers numbers" count="0"/>
+        <!-- invalid xpath, jaxen-34 -->
+      <test exception="true" select="/a/b[c > d]efg" count="0"/>
+        <!-- invalid xpath, jaxen-27 -->
+      <test exception="true" select="/inv/child::" count="0"/>
+        <!-- invalid xpath, jaxen-26 -->
+      <test exception="true" select="/invoice/@test[abcd" count="0"/>
+      <test exception="true" select="/invoice/@test[abcd > x" count="0"/>
+
+        <!-- unterminated string -->
+      <test exception="true" select="string-length('a" count="0"/>
+      <!-- various edge cases where code threw no exception -->
+      <test exception="true" select="/descendant::()" count="0"/>
+      <test exception="true" select="(1 + 1" count="0"/>
+
+    </context>
+  </document>
+
+
+  <!-- test cases for the use of underscores in names -->
+  <document url="xml/underscore.xml">
+    <context select="/">
+      <test select="/root/@a" count="1"/>
+      <test select="/root/@_a" count="1"/>
+      <test select="/root/b" count="1"/>
+      <test select="/root/_b" count="1"/>
+      <valueOf select="/root/@a">1</valueOf>
+      <valueOf select="/root/@_a">2</valueOf>
+      <valueOf select="/root/b">1</valueOf>
+      <valueOf select="/root/_b">2</valueOf>
+    </context>
+  </document>
+
+  <!-- test cases for the use of = with nodesets -->
+  <document url="xml/web.xml">
+    <context select="/">
+      <valueOf select="/web-app/servlet/servlet-name = 'file'">true</valueOf>
+      <valueOf select="/web-app/servlet/servlet-name = 'snoop'">true</valueOf>
+    </context>
+  </document>
+
+  <document url="xml/numbers.xml">
+    <context select="/">
+      <valueOf select="/numbers/set/nr = '-3'">true</valueOf>
+      <valueOf select="/numbers/set/nr = -3">true</valueOf>
+      <valueOf select="/numbers/set/nr = 24">true</valueOf>
+      <valueOf select="/numbers/set/nr/@value = '9999'">true</valueOf>
+      <valueOf select="/numbers/set/nr/@value = 9999.0">true</valueOf>
+      <valueOf select="/numbers/set/nr/@value = 66">true</valueOf>
+    </context>
+  </document>
+
+  <!-- test basic math... -->
+  <document url="xml/numbers.xml">
+    <context select="/">
+      <valueOf select="(8 * 2 + 1) = 17">true</valueOf>
+      <valueOf select="(1 + 8 * 2) = 17">true</valueOf>
+      <valueOf select="(7 - 3 + 1) = 5">true</valueOf>
+      <valueOf select="(8 - 4 + 5 - 6) = 3">true</valueOf>
+      <!-- left-assoc tests, comments show WRONG evaluation -->
+      <!-- 3 - 2 - 1 != 2 -->
+      <valueOf select="3 - 2 - 1">0</valueOf>
+      <!-- 8 div 4 div 2 != 4 -->
+      <valueOf select="8 div 4 div 2">1</valueOf>
+      <!-- 3 mod 5 mod 7 != 1 -->
+      <valueOf select="3 mod 7 mod 5">3</valueOf>
+        <!-- 1=(2=2) is true-->
+      <valueOf select="1 = 2 = 2">false</valueOf>
+        <!--  2!=(3!=1) => 2!=1 => true, (2!=3)!=1 => 1!=1 => false -->
+      <valueOf select="2 != 3 != 1">false</valueOf>
+        <!-- 3 > (2 > 1) is true -->
+      <valueOf select="3 &gt; 2 &gt; 1">false</valueOf>
+        <!-- 3 >= (2 >= 2) is true -->
+      <valueOf select="3 &gt;= 2 &gt;= 2">false</valueOf>
+        <!-- 1 < (2 < 3) is false -->
+      <valueOf select="1 &lt; 2 &lt; 3">true</valueOf>
+        <!-- 0 <= (2 <= 3) is true -->
+      <valueOf select="2 &lt;= 2 &lt;= 3">true</valueOf>
+    </context>
+  </document>
+
+  <!-- test cases for preceding axis with different node types -->
+  <document url="xml/pi2.xml">
+    <context select="/a/c">
+      <test select="//processing-instruction()" count="1"/>
+      <test select="preceding-sibling::*" count="1"/>
+      <test select="preceding-sibling::node()" count="5"/>
+      <test select="preceding-sibling::*[1]" count="1"/>
+      <test select="preceding-sibling::processing-instruction()" count="1"/>
+      <valueOf select="preceding-sibling::processing-instruction()">order-by="x"</valueOf>
+      <valueOf select="preceding-sibling::*[1]">foo</valueOf>
+      <valueOf select="preceding-sibling::node()[2]">order-by="x"</valueOf>
+    </context>
+  </document>
+
+  <document url="xml/id.xml">
+    <context select="/"
+	     var:foobar="foobar"
+	     var:foo="foo">
+      <valueOf select="$foobar">foobar</valueOf>
+      <test select="/foo[@id=$foobar]" count="1"/>
+      <test select="/foo[@id='$foobar']" count="0"/>
+      <test select="/foo[concat($foo, 'bar')=@id]" count="1"/>
+      <test select="CD_Library/artist[@name=$artist]" count="0"/>
+    </context>
+  </document>
+
+  <document url="xml/id.xml">
+    <context select="/">
+      <!-- attributes have a parent: their element -->
+      <test select="/foo/@id/parent::foo" count="1"/>
+    </context>
+    <!-- attributes can also be used as context nodes -->
+    <context select="/foo/@id">
+      <test select="parent::foo" count="1"/>
+    </context>
+  </document>
+
+  <document url="xml/pi.xml">
+    <context select="/">
+      <test select="//processing-instruction()" count="3"/>
+      <test select="//processing-instruction('cheese')" count="2"/>
+      <test select="//processing-instruction('toast')" count="1">
+	<valueOf select="string()">is tasty</valueOf>
+      </test>
+    </context>
+
+  </document>
+
+  <!-- test evaluate() extension function -->
+  <document url="xml/evaluate.xml">
+    <context select="/">
+      <test select="evaluate('//jumps/*')" count="3"/>
+      <test select="evaluate('//jumps/object/dog')" count="1"/>
+      <test select="evaluate('//jumps/object')/evaluate" count="0"/>
+      <test select="evaluate('//jumps/object')/dog" count="1"/>
+      <test select="evaluate('//jumps/*')/dog" count="1"/>
+      <test select="//metatest[ evaluate(@select) = . ]" count="1"/>
+    </context>
+  </document>
+  
+  <document url="xml/numbers.xml">
+    <context select="/numbers/set[1]">
+      <test select="*[-3 = .]" count="1"/>
+      <valueOf select="54 &lt; *">true</valueOf>
+      <valueOf select="55 &lt;= *">true</valueOf>
+      <valueOf select="69 &lt; *">false</valueOf>
+      <valueOf select="-2 &gt; *">true</valueOf>
+      <valueOf select="-3 &gt;= *">true</valueOf>
+      <valueOf select="-4 &gt;= *">false</valueOf>
+    </context>
+    <!-- TODO
+    This context should work, but needs a fixed version of saxpath to parse the right-hand side
+    of the greater-than expression.
+    <context select="/numbers/set[2]">
+      <valueOf select="1 &gt; nr/@value">false</valueOf>
+      <valueOf select="55 &gt; nr/@value">false</valueOf>
+      <valueOf select="55 &gt;= nr/@value">true</valueOf>
+      <valueOf select="1000000 &gt; nr/@value">true</valueOf>
+    </context>
+    -->
+  </document>
+
+
+  <!-- test sibling axes -->
+  <document url="xml/axis.xml">
+
+    <context select="/root">
+      <test select="preceding-sibling::*" count="0"/>
+    </context>
+
+    <context select="/root/a/a.3">
+      <test select="preceding::*" count="2"/>
+    </context>
+
+    <context select="/root/a/a.3">
+      <test select="preceding-sibling::*" count="2"/>
+    </context>
+
+    <context select="/">
+      <valueOf select="name(/root/a/a.3/preceding-sibling::*[1])">a.2</valueOf>
+      <valueOf select="name(/root/a/a.3/preceding-sibling::*[2])">a.1</valueOf>
+    </context>
+
+    <context select="/">
+      <valueOf select="name(/root/a/a.3/following-sibling::*[1])">a.4</valueOf>
+      <valueOf select="name(/root/a/a.3/following-sibling::*[2])">a.5</valueOf>
+    </context>
+
+  </document>
+
+
+  <document url="xml/web.xml">
+
+    <context select="/">
+      <valueOf select="/web-app/servlet[1]/servlet-name">snoop</valueOf>
+      <valueOf select="/web-app/servlet[1]/servlet-name/text()">snoop</valueOf>
+      <valueOf select="/web-app/servlet[2]/servlet-name">file</valueOf>
+      <valueOf select="/web-app/servlet[2]/servlet-name/text()">file</valueOf>
+    </context>
+
+    <context select="/web-app/servlet[1]">
+      <valueOf select="servlet-name">snoop</valueOf>
+      <valueOf select="servlet-name/text()">snoop</valueOf>
+    </context>
+    
+    <context select="/web-app/servlet[2]/servlet-name">
+      <test select="preceding::*" count="3"/>
+    </context>
+
+    <context select="/web-app/servlet[2]/servlet-name">
+      <test select="following::*" count="13"/>
+    </context>
+
+  </document>
+
+
+  <!-- test name -->
+
+  <document url="xml/web.xml">
+    <context select="/">
+      
+      <test select="*" count="1">
+	<valueOf select="name()">web-app</valueOf>
+      </test>
+
+      <!-- NOTE that the child::node() tests only work if the
+      XML document does not comments or PIs
+      -->
+      
+      <test select="./*" count="1">
+	<valueOf select="name()">web-app</valueOf>
+      </test>
+      <test select="child::*" count="1">
+	<valueOf select="name()">web-app</valueOf>
+      </test>
+      <test select="/*" count="1">
+	<valueOf select="name()">web-app</valueOf>
+      </test>
+      <test select="/child::node()" count="1">
+	<valueOf select="name(.)">web-app</valueOf>
+      </test>
+      <test select="child::node()" count="1">
+	<valueOf select="name(.)">web-app</valueOf>
+      </test>
+
+      <!-- empty names -->
+
+      <valueOf select="name()"></valueOf>
+      <valueOf select="name(.)"></valueOf>
+      <valueOf select="name(parent::*)"></valueOf>
+      <valueOf select="name(/)"></valueOf>
+      <valueOf select="name(/.)"></valueOf>
+      <valueOf select="name(/self::node())"></valueOf>
+
+      <!-- name of root elemet -->
+      <valueOf select="name(node())">web-app</valueOf>
+      <valueOf select="name(/node())">web-app</valueOf>
+      <valueOf select="name(/*)">web-app</valueOf>
+      <valueOf select="name(/child::*)">web-app</valueOf>
+      <valueOf select="name(/child::node())">web-app</valueOf>
+      <valueOf select="name(/child::node())">web-app</valueOf>
+      <valueOf select="name(child::node())">web-app</valueOf>
+      <valueOf select="name(./*)">web-app</valueOf>
+      <valueOf select="name(*)">web-app</valueOf>
+
+    </context>
+
+    <context select="/*">
+      <!-- empty names -->
+      <valueOf select="name(..)"></valueOf>
+      <valueOf select="name(parent::node())"></valueOf>
+      <valueOf select="name(parent::*)"></valueOf>
+
+      <!-- name of root elemet -->
+      <valueOf select="name()">web-app</valueOf>
+      <valueOf select="name(.)">web-app</valueOf>
+      <valueOf select="name(../*)">web-app</valueOf>
+      <valueOf select="name(../child::node())">web-app</valueOf>
+    </context>
+  </document>
+
+
+
+  <!-- test predicates -->
+
+  <document url="xml/nitf.xml">
+    <context select="/nitf/head/docdata">
+      <test select="doc-id[@regsrc='AP' and @id-string='D76UIMO80']" count="1"/>
+    </context>
+    <context select="/nitf/head">
+      <test select="meta[@name='ap-cycle']" count="1"/>
+      <test select="meta[@content='AP']" count="1"/>
+      <test select="meta[@name and @content]" count="8"/>
+      <test select="meta[@name='ap-cycle' and @content='AP']" count="1"/>
+      <test select="meta[@name != 'ap-cycle']" count="7"/>
+    </context>
+    <context select="/">
+      <test select="/nitf/head/meta[@name='ap-cycle']" count="1"/>
+      <test select="/nitf/head/meta[@content='AP']" count="1"/>
+      <test select="/nitf/head/meta[@name and @content]" count="8"/>
+      <test select="/nitf/head/meta[@name='ap-cycle' and @content='AP']" count="1"/>
+      <test select="/nitf/head/meta[@name != 'ap-cycle']" count="7"/>
+    </context>
+  </document>
+
+
+  <document url="xml/moreover.xml">
+    <context select="/">
+      <test select="/child::node()" count="1"/>
+      <test select="/*" count="1"/>
+
+      <test select="/*/article" count="20"/>
+      <test select="//*" count="221"/>
+      <test select="//*[local-name()='article']" count="20"/>
+      <test select="//article" count="20"/>
+      <test select="/*/*[@code]" count="20"/>
+
+      <test select="/moreovernews/article[@code='13563275']" count="1"/>
+
+      <test select="/moreovernews/article[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+      <test select="/*/article[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+      <test select="//article[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+      <test select="//*[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+      <test select="/child::node()/child::node()[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+      <test select="/*/*[@code='13563275']">
+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>
+      </test>
+    </context>
+  </document>
+
+
+
+  <!-- test other node types-->
+
+  <document url="xml/contents.xml">
+    <context select="/">
+      <test select="processing-instruction()" count="3"/>
+      <test select="/processing-instruction()" count="3"/>
+      <test select="/comment()" count="1"/>
+      <test select="comment()" count="1"/>
+      <test select="/child::node()/comment()" count="2"/>
+      <test select="/*/comment()" count="2"/>
+      <test select="//comment()" count="3"/>
+    </context>
+  </document>
+
+
+
+  <!-- test positioning -->
+
+  <document url="xml/fibo.xml">
+    <context select="/">
+      <test select="/*/fibonacci[position() &lt; 10]" count="9"/>
+      <valueOf select="sum(//fibonacci)">196417</valueOf>
+      <valueOf select="sum(//fibonacci/@index)">325</valueOf>
+      <valueOf select="/*/fibonacci[2]">1</valueOf>
+      <valueOf select="/*/fibonacci[ count(/*/fibonacci) ]">75025</valueOf>
+      <valueOf select="/*/fibonacci[ count(/*/fibonacci) - 1 ]">46368</valueOf>
+    </context>
+  </document>
+
+
+  <!-- test number functions -->
+
+  <!-- test Axes -->
+
+  <document url="xml/web.xml">
+    <context select="/">
+      <test select="descendant-or-self::*" count="19"/>
+      <test select="descendant::*" count="19"/>
+      <test select="/descendant::*" count="19"/>
+      <test select="/descendant-or-self::*" count="19"/>
+      <test select="/descendant::servlet" count="2"/>
+      <test select="/descendant-or-self::servlet" count="2"/>
+      <test select="descendant-or-self::servlet" count="2"/>
+      <test select="descendant::servlet" count="2"/>
+      <test select="/*/servlet" count="2"/>
+      <valueOf select="count(/*/servlet)">2</valueOf>
+      <test select="//servlet" count="2"/>
+      <valueOf select="count(//servlet)">2</valueOf>
+    </context>
+    <context select="/web-app">
+      <test select="/descendant::servlet" count="2"/>
+      <test select="/descendant-or-self::servlet" count="2"/>
+      <test select="descendant-or-self::servlet" count="2"/>
+      <test select="descendant::servlet" count="2"/>
+    </context>
+  </document>
+
+  <document url="xml/much_ado.xml">
+    <context select="/">
+      <test select="/descendant::ACT" count="5"/>
+      <test select="descendant::ACT" count="5"/>
+      <valueOf select="/PLAY/TITLE">Much Ado about Nothing</valueOf>
+      <valueOf select="2+2">4</valueOf>
+      <valueOf select="5 * 4 + 1">21</valueOf>
+      <valueOf select="count(descendant::ACT)">5</valueOf>
+      <valueOf select="10 + count(descendant::ACT) * 5">35</valueOf>
+      <valueOf select="(10 + count(descendant::ACT)) * 5">75</valueOf>
+    </context>
+    <context select="/PLAY/ACT[2]/SCENE[1]">
+      <test select="/descendant::ACT" count="5"/>
+      <test select="../../descendant::ACT" count="5"/>
+      <test select="/PLAY/ACT[2]/SCENE[1]/descendant::SPEAKER" count="141"/>
+      <test select="descendant::SPEAKER" count="141"/>
+      <valueOf select="count(descendant::*)+1">646</valueOf>
+      <valueOf select="count(descendant::SPEAKER)+1">142</valueOf>
+      <valueOf select="count(ancestor::*)">2</valueOf>
+      <valueOf select="count(ancestor::PLAY)">1</valueOf>
+      <valueOf select="count(ancestor-or-self::*)">3</valueOf>
+      <valueOf select="count(ancestor-or-self::PLAY)">1</valueOf>
+      <valueOf select="5+count(ancestor::*)-1">6</valueOf>
+    </context>
+    <context select="/">
+      <!-- Test correct predicate application -->
+      <valueOf select="count(/PLAY/ACT/SCENE[1])">5</valueOf>
+    </context>
+  </document>
+
+  <!-- test axis node ordering -->
+  <document url="xml/web.xml">
+    <context select="/">
+      <!-- Reported as Jira issue JAXEN-24 -->
+      <test select="//servlet-mapping/preceding::*[1][name()='description']" count="1"/>
+      <test select="/web-app/servlet//description/following::*[1][name()='servlet-mapping']" count="1"/>
+      <test select="/web-app/servlet//description/following::*[2][name()='servlet-name']" count="1"/>
+    </context>
+  </document>
+  
+  <!-- test document function -->
+  <document url="xml/text.xml">
+    <context select="/">
+      <test select="document('xml/web.xml')" count="1">
+	<valueOf select="/web-app/servlet[1]/servlet-name">snoop</valueOf>
+	<valueOf select="/web-app/servlet[1]/servlet-name/text()">snoop</valueOf>
+      </test>
+      <valueOf select="document('xml/web.xml')/web-app/servlet[1]/servlet-name">snoop</valueOf>
+    </context>
+    <!-- Test to check if the context changes when an extension function is used.
+    First test is an example, second is the actual test.
+    -->
+    <context select="/foo/bar/cheese[1]">
+      <valueOf select="concat(./@id,'foo',@id)">3foo3</valueOf>
+      <valueOf select="concat(./@id,document('xml/web.xml')/web-app/servlet[1]/servlet-name,./@id)">3snoop3</valueOf>
+    </context>
+  </document>
+
+  <document url="xml/message.xml">
+    <context select="/">
+      <valueOf select="/message/body/data/items/item[name/text()='parentinfo']/value">Pruefgebiete</valueOf>
+      <valueOf select="document('xml/message.xml')/message/body/data/items/item[name/text()='parentinfo']/value">Pruefgebiete</valueOf>
+    </context>
+  </document>
+
+  <document url="xml/simple.xml">
+
+    <!-- test behaviour of AbsoluteLocationPath -->
+    <context select="/root/a">
+      <valueOf select="concat( ., /root/b )">ab</valueOf>
+      <valueOf select="concat( ../b, . )">ba</valueOf>
+      <valueOf select="concat( /root/b, . )">ba</valueOf>
+      <valueOf select="concat( /root/c/d, ../b )">db</valueOf>
+    </context>
+
+    <!-- test the translate() function -->
+    <context select="/">
+      <valueOf select="translate( '', '', '' )"></valueOf>
+      <valueOf select="translate( 'abcd', '', '' )">abcd</valueOf>
+      <valueOf select="translate( 'abcd', 'abcd', 'abcd' )">abcd</valueOf>
+      <valueOf select="translate( 'abcd', 'dcba', 'dcba' )">abcd</valueOf>
+      <valueOf select="translate( 'abcd', 'abcd', 'dcba' )">dcba</valueOf>
+      <valueOf select="translate( 'abcd', 'abcd', 'ab' )">ab</valueOf>
+      <valueOf select="translate( 'abcd', 'cdab', 'cd' )">cd</valueOf>
+      <valueOf select="translate( 'abcd', 'acbd', 'xy' )">xy</valueOf>
+      <valueOf select="translate( 'abcd', 'abcdb', 'abcdb' )">abcd</valueOf>
+      <valueOf select="translate( 'abcd', 'abcd', 'abcdb' )">abcd</valueOf>
+    </context>
+
+    <context select="/">
+      <valueOf select="substring('12345', 1.5, 2.6)">234</valueOf>
+      <valueOf select="substring('12345', 0, 3)">12</valueOf>
+      <valueOf select="substring('12345', 0 div 0, 3)"></valueOf>
+      <valueOf select="substring('12345', 1, 0 div 0)"></valueOf>
+      <valueOf select="substring('12345', -42, 1 div 0)">12345</valueOf>
+      <valueOf select="substring('12345', -1 div 0, 1 div 0)"></valueOf>
+      <valueOf select="substring('12345', 3)">345</valueOf>
+      <valueOf select="substring('12345',1,15)">12345</valueOf>
+    </context>
+
+	<!-- Some tests for the normalize-space() function -->
+	
+	<context select="/">
+	  <valueOf select="normalize-space('    abc    ')">abc</valueOf>
+	  <valueOf select="normalize-space(' a  b  c  ')">a b c</valueOf>
+	  <valueOf select="normalize-space(' a &#x0d; b &#x0a;  c  ')">a b c</valueOf>
+	  <!-- Next test case addresses issue JAXEN-22 -->
+	  <valueOf select="normalize-space(' ')"></valueOf>
+	  <!-- Next test case addresses issue JAXEN-29 -->
+	  <valueOf select="normalize-space('')"></valueOf>
+	</context>
+  </document>
+
+
+
+  <!-- test cases for String extension functions -->
+  <document url="xml/web.xml">
+    <context select="/web-app/servlet[1]">
+      <valueOf select="upper-case( servlet-class )">SNOOPSERVLET</valueOf>
+      <valueOf select="lower-case( servlet-class )">snoopservlet</valueOf>
+      <valueOf select="upper-case( servlet-class, 'fr' )">SNOOPSERVLET</valueOf>
+      <valueOf select="upper-case( servlet-class, 'fr-CA' )">SNOOPSERVLET</valueOf>
+      <valueOf select="upper-case( servlet-class, 'es-ES-Traditional_WIN' )">SNOOPSERVLET</valueOf>
+      <valueOf select="ends-with( servlet-class, 'Servlet' )">true</valueOf>
+      <valueOf select="ends-with( servlet-class, 'S' )">false</valueOf>
+    </context>
+  </document>
+
+  <!-- test cases for the lang() function -->
+  <document url="xml/lang.xml">
+    <context select="/">
+      <test select="/e1/e2[lang('hr')]" count="0"/>
+      <test select="/e1/e2/e3[lang('en')]" count="1"/>
+      <test select="/e1/e2/e3[lang('en-US')]" count="1"/>
+      <test select="/e1/e2/e3[lang('en-GB')]" count="0"/>
+      <test select="/e1/e2/e3[lang('hu')]" count="2"/>
+      <test select="/e1/e2/e3[lang('hu-HU')]" count="0"/>
+      <test select="/e1/e2/e3[lang('es')]" count="1"/>
+      <test select="/e1/e2/e3[lang('es-BR')]" count="0"/>
+    </context>
+  </document>
+
+  <!-- test namespace -->
+  <document url="xml/namespaces.xml">
+    <context select="/"
+	     xmlns:foo="http://fooNamespace/"
+	     xmlns:voo="http://fooNamespace/"
+	     xmlns:bar="http://barNamespace/"
+	     xmlns:alias="http://fooNamespace/">
+      <test select="/*" count="1"/>
+      <test select="/foo:a" count="1"/>
+      <test select="/foo:a/b" count="1"/>
+      <test select="/voo:a/b/c" count="1"/>
+      <test select="/voo:a/bar:f" count="1"/>
+      <test select="/*[namespace-uri()='http://fooNamespace/' and local-name()='a']" count="1"/>
+      <test select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']" count="1"/>
+      <test select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']" count="1"/>
+    </context>
+    <!-- the prefix here and in the document have no relation; it's their
+    namespace-uri binding that counts -->
+    <context select="/" xmlns:foo="http://somethingElse/">
+      <test select="/foo:a/b/c" count="0"/>
+    </context>
+
+    <context select="/"
+	     xmlns:foo="http://fooNamespace/"
+	     xmlns:bar="http://barNamespace/"
+	     xmlns:alias="http://fooNamespace/">
+      <valueOf select="/foo:a/b/c">Hello</valueOf>
+      <valueOf select="/foo:a/foo:d/foo:e">Hey</valueOf>
+      <valueOf select="/foo:a/alias:x/alias:y">Hey3</valueOf>
+      <valueOf select="/foo:a/foo:x/foo:y">Hey3</valueOf>
+      <valueOf select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']">Hey3</valueOf>
+    </context>
+
+  </document>
+
+  <document url="xml/defaultNamespace.xml">
+    <context select="/">
+      <!-- NOTE: /a/b/c selects elements in no namespace only! -->
+      <test select="/a/b/c" count="0"/>
+      <!--
+        The following test uses an unbound prefix 'x' and should throw an exception.
+        Addresses issue JAXEN-18.
+        Turns out this isn't really tested as the test didn't fail when the exception wasn't thrown.
+      <test select="/x:a/x:b/x:c" count="0" exception="true"/>
+      -->
+    </context>
+    <context select="/"
+	     xmlns:dummy="http://dummyNamespace/">
+      <test select="/dummy:a/dummy:b/dummy:c" count="1"/>
+    </context>
+  </document>
+  <document url="xml/text.xml">
+    <context select="/">
+      <test select="/foo/bar/text()" count="3"/>
+      <valueOf select="normalize-space(/foo/bar/text())">baz</valueOf>
+    </context>
+  </document>
+
+  <document url="xml/testNamespaces.xml">
+    <context select="/">
+      <!-- the root is not an element, so no namespaces -->
+      <test select="namespace::*" count="0" debug="off"/>
+      <test select="/namespace::*" count="0" debug="off"/>
+      <!-- must count the default xml: prefix as well -->
+      <test select="/Template/Application1/namespace::*" count="3" debug="off"/>
+      <test select="/Template/Application2/namespace::*" count="3" debug="off"/>
+
+      <!-- every element has separate copies -->
+      <test select="//namespace::*" count="25" debug="off"/>
+    </context>
+
+    <context select="/Template/Application1">
+      <!-- must count the default xml: prefix as well -->
+      <test select="namespace::*" count="3" debug="off"/>
+      <test select="/namespace::*" count="0" debug="off"/>
+      <test select="/Template/Application1/namespace::*" count="3" debug="off"/>
+      <test select="/Template/Application2/namespace::*" count="3" debug="off"/>
+      <test select="//namespace::*" count="25" debug="off"/>
+      <test select="//namespace::xplt" count="8" debug="off"/>
+      <!-- the name test literally matches the prefix as given in the
+      document, and does not use the uri -->
+      <test xmlns:somethingelse="http://www.xxxx.com/"
+	    select="//namespace::somethingelse" count="0" debug="off"/>
+    </context>
+  </document>
+
+  <document url="xml/testNamespaces.xml">
+    <context select="/">
+      <!-- namespace nodes have their element as their parent -->
+      <test select="/Template/namespace::xml/parent::Template" count="1"/>
+    </context>
+    <!-- namespace nodes can also be used as context nodes -->
+    <context select="/Template/namespace::xml">
+      <test select="parent::Template" count="1"/>
+    </context>
+  </document>
+
+</tests>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xsl?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xsl (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xsl Mon Jul 11 13:44:10 2005
@@ -0,0 +1,369 @@
+<stylesheet	xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:var="http://jaxen.org/test-harness/var">
+<!-- this is what I used to generate XPathTestBase. After generating I fixed the illegal strings (its quicker
+than fixing the xsl for that few errors) and reformatted the code. Its unlikely this code will be needed
+again, its just in cvs for completeness -->
+    <output method="text"/>
+    <template match="/">
+        <text>
+            /*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/XPathTestBase.java,v 1.32 2005/06/15 23:52:40 bewins Exp $
+ * $Revision: 1.32 $
+ * $Date: 2005/06/15 23:52:40 $
+ *
+ * ====================================================================
+ *
+ * Copyright (C) 2000-2002 bob mcwhirter &amp; James Strachan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions, and the disclaimer that follows
+ *    these conditions in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * 3. The name "Jaxen" must not be used to endorse or promote products
+ *    derived from this software without prior written permission.  For
+ *    written permission, please contact license@jaxen.org.
+ *
+ * 4. Products derived from this software may not be called "Jaxen", nor
+ *    may "Jaxen" appear in their name, without prior written permission
+ *    from the Jaxen Project Management (pm@jaxen.org).
+ *
+ * In addition, we request (but do not require) that you include in the
+ * end-user documentation provided with the redistribution and/or in the
+ * software itself an acknowledgement equivalent to the following:
+ *     "This product includes software developed by the
+ *      Jaxen Project (http://www.jaxen.org/)."
+ * Alternatively, the acknowledgment may be graphical using the logos
+ * available at http://www.jaxen.org/
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE Jaxen AUTHORS OR THE PROJECT
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter &lt;bob@werken.com> and
+ * James Strachan &lt;jstrachan@apache.org>.  For more information on the
+ * Jaxen Project, please see &lt;http://www.jaxen.org/>.
+ *
+ * $Id: XPathTestBase.java,v 1.32 2005/06/15 23:52:40 bewins Exp $
+ */
+
+
+package org.jaxen;
+
+import junit.framework.TestCase;
+import org.jaxen.function.StringFunction;
+import org.jaxen.saxpath.helpers.XPathReaderFactory;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class XPathTestBase extends TestCase
+{
+    protected static String VAR_URI   = "http://jaxen.org/test-harness/var";
+    protected static String TESTS_XML = "xml/test/tests.xml";
+
+    protected static boolean verbose = true;
+    protected static boolean debug = true;
+    private ContextSupport  contextSupport;
+
+    public XPathTestBase(String name)
+    {
+        super( name );
+    }
+
+    public void setUp() throws ParserConfigurationException
+    {
+        this.contextSupport = null;
+        System.setProperty( XPathReaderFactory.DRIVER_PROPERTY,
+                            "" );
+        log( "-----------------------------" );
+    }
+
+    public void log(String text)
+    {
+        log( verbose,
+             text );
+    }
+
+    public void log(boolean actualVerbose,
+                    String text)
+    {
+        if ( ! actualVerbose )
+        {
+            return;
+        }
+
+        System.out.println( text );
+    }
+
+    protected void assertCountXPath(int expectedSize, Object context, String xpathStr) throws JaxenException {
+        try
+        {
+            assertCountXPath2(expectedSize, context, xpathStr);
+        }
+        catch (UnsupportedAxisException e)
+        {
+            log ( debug,
+                  "      ## SKIPPED -- Unsupported Axis" );
+        }
+    }
+
+    protected Object assertCountXPath2(int expectedSize, Object context, String xpathStr) throws JaxenException {
+        log ( debug,
+              "  Select :: " + xpathStr );
+        BaseXPath xpath = new BaseXPath( xpathStr );
+        List results = xpath.selectNodes( getContext( context ) );
+        log ( debug,
+              "    Expected Size :: " + expectedSize );
+        log ( debug,
+              "    Result Size   :: " + results.size() );
+
+        if ( expectedSize != results.size() )
+        {
+            log ( debug,
+                  "      ## FAILED" );
+            log ( debug,
+                  "      ## xpath: " + xpath + " = " + xpath.debug() );
+
+            Iterator resultIter = results.iterator();
+
+            while ( resultIter.hasNext() )
+            {
+                log ( debug,
+                      "      --> " + resultIter.next() );
+            }
+        }
+        assertEquals( xpathStr,
+                      expectedSize,
+                      results.size() );
+        if (expectedSize > 0) {
+            return results.get(0);
+        }
+        return null;
+    }
+
+    protected void assertInvalidXPath(Object context, String xpathStr) throws JaxenException {
+        try 
+        {
+            log ( debug,
+                  "  Select :: " + xpathStr );
+            BaseXPath xpath = new BaseXPath( xpathStr );
+            List results = xpath.selectNodes( getContext( context ) );
+            log ( debug,
+                  "    Result Size   :: " + results.size() );
+            fail("An exception was expected.");
+        }
+        catch (UnsupportedAxisException e)
+        {
+            log ( debug,
+                  "      ## SKIPPED -- Unsupported Axis" );
+        }
+        catch (JaxenException e) {
+            log (debug, "    Caught expected exception "+e.getMessage());
+        }
+    }
+
+    protected void assertValueOfXPath(String expected, Object context, String xpathStr) throws JaxenException {
+        try
+        {
+            BaseXPath xpath = new BaseXPath( xpathStr );
+            Object node = xpath.evaluate( getContext( context ) );
+            
+            String result = StringFunction.evaluate( node,
+                                                     getNavigator() );
+            
+            log ( debug,
+                  "  Select :: " + xpathStr );
+            log ( debug,
+                  "    Expected :: " + expected );
+            log ( debug,
+                  "    Result   :: " + result );
+            
+            if ( ! expected.equals( result ) )
+            {
+                log ( debug,
+                      "      ## FAILED" );
+                log ( debug,
+                      "      ## xpath: " + xpath + " = " + xpath.debug() );
+            }
+            
+            assertEquals( xpathStr,
+                          expected,
+                          result );
+        }
+        catch (UnsupportedAxisException e)
+        {
+            log ( debug,
+                  "      ## SKIPPED -- Unsupported Axis " );
+
+        }        
+    }
+    protected Context getContext(Object contextNode)
+    {
+        Context context = new Context( getContextSupport() );
+
+        List list = new ArrayList( 1 );
+        list.add( contextNode );
+        context.setNodeSet( list );
+
+        return context;
+    }
+
+    public ContextSupport getContextSupport()
+    {
+        if ( this.contextSupport == null )
+        {
+            this.contextSupport = new ContextSupport( new SimpleNamespaceContext(),
+                                                      XPathFunctionContext.getInstance(),
+                                                      new SimpleVariableContext(),
+                                                      getNavigator() );
+        }
+
+        return this.contextSupport;
+    }
+
+    public abstract Navigator getNavigator();
+
+    public abstract Object getDocument(String url) throws Exception;
+
+    public void testGetNodeType() throws FunctionCallException, UnsupportedAxisException
+    {
+        Navigator nav = getNavigator();
+        Object document = nav.getDocument("xml/testNamespaces.xml");
+        int count = 0;
+        Iterator descendantOrSelfAxisIterator = nav.getDescendantOrSelfAxisIterator(document);
+        while (descendantOrSelfAxisIterator.hasNext()) {
+            Object node = descendantOrSelfAxisIterator.next();
+            Iterator namespaceAxisIterator = nav.getNamespaceAxisIterator(node);
+            while (namespaceAxisIterator.hasNext()) {
+                count++;
+                assertEquals("Node type mismatch", Pattern.NAMESPACE_NODE, nav.getNodeType(namespaceAxisIterator.next()));
+            }
+        }
+        assertEquals(25, count);
+    }
+
+        </text>
+        <apply-templates select="node()|@*"/>
+        <text>
+}            
+        </text>
+    </template>
+    <template match="context">
+        <text>
+    public void test</text><value-of select="generate-id()"/><text>() throws JaxenException {
+        Navigator nav = getNavigator();
+        String url = "</text><value-of select="../@url"/><text>";
+        log( "Document [" + url + "]" );
+        Object document = nav.getDocument(url);
+
+        XPath contextpath = new BaseXPath("</text><value-of select="@select"/><text>", nav);
+        log( "Initial Context :: " + contextpath );
+        List list = contextpath.selectNodes(document);
+        </text>
+        <if test="count(namespace::*) > count(../namespace::*)">
+        <text>
+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();</text>
+            <for-each select="namespace::*[local-name() != 'var' and local-name() != 'xml']">
+                <text>
+        nsContext.addNamespace( "</text><value-of select="local-name()"/><text>", "</text><value-of select="."/><text>" );</text>
+           </for-each>
+            <text>
+        getContextSupport().setNamespaceContext( nsContext );</text>
+        </if>
+        <if test="@*[namespace-uri() = 'http://jaxen.org/test-harness/var']">
+        <text>
+        SimpleVariableContext varContext = new SimpleVariableContext();</text>
+            <for-each select="@*[namespace-uri() = 'http://jaxen.org/test-harness/var']">
+                <text>
+        varContext.setVariableValue(null, "</text><value-of select="local-name()"/><text>", "</text><value-of select="."/><text>" );</text>
+           </for-each>
+            <text>
+        getContextSupport().setVariableContext( varContext );</text>
+        </if>
+        <text>
+        Iterator iter = list.iterator();
+        while (iter.hasNext()) {
+            Object context = iter.next();</text>
+            <apply-templates select="node()|@*"/>
+        <text>
+        }
+    }</text>
+    </template>
+    <template match="test[@exception]">
+        <text>
+            assertInvalidXPath(context, "</text><value-of select='@select'/><text>");</text>
+    </template>
+    <template match="test[valueOf]">
+        <choose>
+            <when test="@count">
+                <text>
+            try
+            {
+                Object result = assertCountXPath2(</text><value-of select="@count"/><text>, context, "</text><value-of select="@select"/><text>");</text>
+        <for-each select="valueOf">
+            <text>
+                assertValueOfXPath("</text><value-of select="."/><text>", result, "</text><value-of select="@select"/><text>");</text>
+        </for-each>
+        <text>
+            }
+            catch (UnsupportedAxisException e)
+            {
+                log ( debug, "      ## SKIPPED -- Unsupported Axis" );
+            }</text>
+            </when>
+            <otherwise>
+                <text>
+            try
+            {
+                BaseXPath xpath = new BaseXPath( "</text><value-of select="@select"/><text>" );
+                List results = xpath.selectNodes( getContext( context ) );
+                Object result = results.get(0);</text>
+        <for-each select="valueOf">
+            <text>
+                assertValueOfXPath("</text><value-of select="."/><text>", result, "</text><value-of select="@select"/><text>");</text>
+        </for-each>
+        <text>
+            }
+            catch (UnsupportedAxisException e)
+            {
+                log ( debug, "      ## SKIPPED -- Unsupported Axis" );
+            }</text>
+            </otherwise>
+        </choose>
+    </template>
+    <template match="test">
+        <text>
+            assertCountXPath(</text><value-of select="@count"/><text>, context, "</text><value-of select="@select"/><text>");</text>
+    </template>
+    <template match="valueOf">
+        <text>
+            assertValueOfXPath("</text><value-of select="."/>", context, "<value-of select="@select"/><text>");</text>
+    </template>
+    <template match="comment()"><text>
+    /*</text><value-of select="."/><text>
+    */</text>
+    </template>
+    <template match="node()|@*"><apply-templates select="node()|@*"/></template>    
+</stylesheet>
\ No newline at end of file

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/test/tests.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/testNamespaces.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/testNamespaces.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/testNamespaces.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/testNamespaces.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,22 @@
+<Template> 
+  <Application1 xmlns:xplt="http://www.xxxx.com/"
+                xmlns:xpl="http://www.xxxx.com/"
+                version="3.0"
+                randomAttribute="foo"
+  >
+    <xpl:insertText/> 
+    <xplt:anyElement> 
+      <Name/> 
+    </xplt:anyElement> 
+  </Application1> 
+
+  <Application2 xmlns:xplt="http://www.xxxx.com/"
+                xmlns:xpl="http://www.xxxx.com/"
+                version="3.0"
+  > 
+    <xpl:insertText/> 
+    <xplt:anyElement> 
+      <Name/> 
+    </xplt:anyElement> 
+  </Application2> 
+</Template>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/testNamespaces.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/text.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/text.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/text.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/text.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<foo>
+	<bar>
+		baz
+		<cheese id="3"/>
+		baz
+		<cheese/>
+		baz
+	</bar>
+</foo>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/text.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/underscore.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/underscore.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/underscore.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/underscore.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?>
+<root a="1" _a="2">
+  <b>1</b>
+  <_b>2</_b>
+</root>
+  

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/underscore.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/web.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/web.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/web.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/web.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app>
+  <servlet>
+    <servlet-name>snoop</servlet-name>
+    <servlet-class>SnoopServlet</servlet-class>
+  </servlet>
+  <servlet>
+    <servlet-name>file</servlet-name>
+    <servlet-class>ViewFile</servlet-class>
+    <init-param>
+      <param-name>initial</param-name>
+      <param-value>
+        1000
+      </param-value>
+      <description>
+        The initial value for the counter  <!-- optional -->
+      </description>
+    </init-param>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>
+      mv
+    </servlet-name>
+    <url-pattern>
+      *.wm
+    </url-pattern>
+  </servlet-mapping>
+
+  <distributed/>
+
+  <security-role>
+    <role-name>
+     manager
+    </role-name>
+    <role-name>
+     director
+    </role-name>
+    <role-name>
+     president
+    </role-name>
+  </security-role>
+</web-app>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test-resources/xml/web2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/xml/web2.xml?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/xml/web2.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/xml/web2.xml Mon Jul 11 13:44:10 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<root>
+  <b>
+    <d />
+  </b>
+  <c />
+</root>

Propchange: webservices/axis/trunk/java/modules/xml/test-resources/xml/web2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/xpath/AXIOMXPathTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/xpath/AXIOMXPathTest.java?rev=210210&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/xpath/AXIOMXPathTest.java (added)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/xpath/AXIOMXPathTest.java Mon Jul 11 13:44:10 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.xpath;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.om.xpath.DocumentNavigator;
+import org.jaxen.FunctionCallException;
+import org.jaxen.Navigator;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+
+public class AXIOMXPathTest extends XPathTestBase {
+    public AXIOMXPathTest(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(AXIOMXPathTest.class);
+    }
+
+    public Navigator getNavigator() {
+        return new DocumentNavigator();
+    }
+
+    public Object getDocument(String uri) throws Exception {
+        try {
+            XMLStreamReader parser =
+                    XMLInputFactory.newInstance().createXMLStreamReader(
+                            new FileInputStream(uri));
+            StAXOMBuilder builder =
+                    new StAXOMBuilder(parser);
+            return builder.getDocumentElement();
+        } catch (Exception e) {
+            throw new FunctionCallException(e);
+        }
+    }
+}

Propchange: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/xpath/AXIOMXPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native