dmitri 2002/12/01 17:12:20
Modified: jxpath/src/test/org/apache/commons/jxpath/ri/model
XMLModelTestCase.java
jxpath/src/java/org/apache/commons/jxpath/ri/model/dom
DOMAttributeIterator.java
Log:
Applied patch submitted by Ulrich Nicolas Liss�
Revision Changes Path
1.7 +9 -4
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
Index: XMLModelTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLModelTestCase.java 29 Nov 2002 07:22:01 -0000 1.6
+++ XMLModelTestCase.java 2 Dec 2002 01:12:19 -0000 1.7
@@ -495,6 +495,11 @@
"vendor/location/@missing",
null);
+ // Missing attribute with namespace
+ assertXPathValueLenient(context,
+ "vendor/location/@miss:missing",
+ null);
+
// Using attribute in a predicate
assertXPathValue(context,
"vendor/location[@id='101']//street",
1.7 +17 -15
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
Index: DOMAttributeIterator.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOMAttributeIterator.java 10 Aug 2002 16:13:04 -0000 1.6
+++ DOMAttributeIterator.java 2 Dec 2002 01:12:20 -0000 1.7
@@ -164,19 +164,21 @@
if (testNS != null){
Attr attr = element.getAttributeNodeNS(testNS, name.getName());
- if (attr == null){
- // This may mean that the parser does not support NS for
- // attributes, example - the version of Crimson bundled
- // with JDK 1.4.0
- NamedNodeMap nnm = element.getAttributes();
- for (int i = 0; i < nnm.getLength(); i++){
- attr = (Attr)nnm.item(i);
- if (testAttr(attr, name)){
- return attr;
- }
+ if (attr != null){
+ return attr;
+ }
+
+ // This may mean that the parser does not support NS for
+ // attributes, example - the version of Crimson bundled
+ // with JDK 1.4.0
+ NamedNodeMap nnm = element.getAttributes();
+ for (int i = 0; i < nnm.getLength(); i++){
+ attr = (Attr)nnm.item(i);
+ if (testAttr(attr, name)){
+ return attr;
}
}
- return attr;
+ return null;
}
else {
return element.getAttributeNode(name.getName());
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>