commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r617923 - in /commons/proper/jxpath/trunk/src: java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
Date Sat, 02 Feb 2008 23:16:29 GMT
Author: mbenson
Date: Sat Feb  2 15:16:01 2008
New Revision: 617923

URL: http://svn.apache.org/viewvc?rev=617923&view=rev
Log:
[JXPATH-114] properly implement node()

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java?rev=617923&r1=617922&r2=617923&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
Sat Feb  2 15:16:01 2008
@@ -144,8 +144,7 @@
             int nodeType = node.getNodeType();
             switch (((NodeTypeTest) test).getNodeType()) {
                 case Compiler.NODE_TYPE_NODE :
-                    return nodeType == Node.ELEMENT_NODE
-                            || nodeType == Node.DOCUMENT_NODE;
+                    return true;
                 case Compiler.NODE_TYPE_TEXT :
                     return nodeType == Node.CDATA_SECTION_NODE
                         || nodeType == Node.TEXT_NODE;

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java?rev=617923&r1=617922&r2=617923&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
Sat Feb  2 15:16:01 2008
@@ -388,7 +388,7 @@
         if (test instanceof NodeTypeTest) {
             switch (((NodeTypeTest) test).getNodeType()) {
                 case Compiler.NODE_TYPE_NODE :
-                    return (node instanceof Element) || (node instanceof Document);
+                    return true;
                 case Compiler.NODE_TYPE_TEXT :
                     return (node instanceof Text) || (node instanceof CDATA);
                 case Compiler.NODE_TYPE_COMMENT :

Modified: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java?rev=617923&r1=617922&r2=617923&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
(original)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
Sat Feb  2 15:16:01 2008
@@ -470,7 +470,9 @@
                 context,
                 "//location[2]/preceding-sibling::location//street",
         "/vendor[1]/location[1]/address[1]/street[1]");
-        assertXPathPointer(context, "//location[2]/preceding::node()[1]", "/vendor[1]/location[1]/employeeCount[1]");
+        assertXPathPointer(context, "//location[2]/preceding::*[1]", "/vendor[1]/location[1]/employeeCount[1]");
+        assertXPathPointer(context, "//location[2]/preceding::node()[3]", "/vendor[1]/location[1]/employeeCount[1]/text()[1]");
+        assertXPathPointer(context, "//location[2]/preceding::node()[4]", "/vendor[1]/location[1]/employeeCount[1]");
     }
 
     public void testAxisAttribute() {
@@ -639,7 +641,7 @@
             context,
             "//location/following::price:sale/saleEnds",
             "never");
-        assertXPathPointer(context, "//location[2]/following::node()[1]", "/vendor[1]/product[1]");
+        assertXPathPointer(context, "//location[2]/following::node()[2]", "/vendor[1]/product[1]");
     }
 
     public void testAxisSelf() {



Mime
View raw message