commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r494917 - in /jakarta/commons/proper/jxpath/trunk/src: java/org/apache/commons/jxpath/ri/model/dom/ java/org/apache/commons/jxpath/ri/model/jdom/ test/org/apache/commons/jxpath/ri/model/dom/ test/org/apache/commons/jxpath/ri/model/jdom/
Date Wed, 10 Jan 2007 18:27:21 GMT
Author: mbenson
Date: Wed Jan 10 10:27:20 2007
New Revision: 494917

URL: http://svn.apache.org/viewvc?view=rev&rev=494917
Log:
[JXPATH-12] Descendant or self axis does not work correctly at root node.
Contributed by Marcin Sarniak.

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

Modified: jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java?view=diff&rev=494917&r1=494916&r2=494917
==============================================================================
--- jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
(original)
+++ jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
Wed Jan 10 10:27:20 2007
@@ -113,7 +113,8 @@
             int nodeType = node.getNodeType();
             switch (((NodeTypeTest) test).getNodeType()) {
                 case Compiler.NODE_TYPE_NODE :
-                    return nodeType == Node.ELEMENT_NODE;
+                    return nodeType == Node.ELEMENT_NODE
+                            || nodeType == Node.DOCUMENT_NODE;
                 case Compiler.NODE_TYPE_TEXT :
                     return nodeType == Node.CDATA_SECTION_NODE
                         || nodeType == Node.TEXT_NODE;

Modified: jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java?view=diff&rev=494917&r1=494916&r2=494917
==============================================================================
--- jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
(original)
+++ jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
Wed Jan 10 10:27:20 2007
@@ -373,7 +373,7 @@
         else if (test instanceof NodeTypeTest) {
             switch (((NodeTypeTest) test).getNodeType()) {
                 case Compiler.NODE_TYPE_NODE :
-                    return node instanceof Element;
+                    return (node instanceof Element) || (node instanceof Document);
                 case Compiler.NODE_TYPE_TEXT :
                     return (node instanceof Text) || (node instanceof CDATA);
                 case Compiler.NODE_TYPE_COMMENT :

Modified: jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java?view=diff&rev=494917&r1=494916&r2=494917
==============================================================================
--- jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java
(original)
+++ jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java
Wed Jan 10 10:27:20 2007
@@ -65,6 +65,7 @@
         assertXPathNodeType(context, "/", Document.class);
         assertXPathNodeType(context, "/vendor/location", Element.class);
         assertXPathNodeType(context, "//location/@name", Attr.class);
+        assertXPathNodeType(context, "//vendor", Element.class);
     }
     
     protected String getXMLSignature(

Modified: jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java?view=diff&rev=494917&r1=494916&r2=494917
==============================================================================
--- jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java
(original)
+++ jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java
Wed Jan 10 10:27:20 2007
@@ -62,7 +62,8 @@
         assertXPathNodeType(context, "/", Document.class);
         assertXPathNodeType(context, "/vendor/location", Element.class);
         assertXPathNodeType(context, "//location/@name", Attribute.class);
-    }    
+        assertXPathNodeType(context, "//vendor", Element.class); //bugzilla #38586
+    }
     
     public void testID() {
         // id() is not supported by JDOM



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message