You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/02/03 00:16:29 UTC
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
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() {