[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jxpath][PATCH] namespaced DOM attributes bug
From:       Ulrich_Nicolas_Lissé <u.n.l () gmx ! net>
Date:       2002-11-30 18:08:08
[Download RAW message or body]

hi folks,

while playing around with the schmematron validation used for xmlforms
in cocoon 2.1 i had to face some strange misbehaviour with namespaced
DOM attributes. downtracking led me to a bug in JXPath's
DOMAttributeIterator: if you have an element with any qualified
attributes and if you specify a non-existent namespaced attribute
expression, JXPath will not return null() but one of the existing
attributes.

i've attached both a simple example illustrating the bug and the
patch. the misbehaviour occurs because the 'getAttribute' method will
return the last negatively tested attribute instead of [null].

i don't know if the jdom-adapter is affected too.

uli
-- 
Ulrich Nicolas Lissé
["NamespacedDOMAttributesPatch.txt" (text/plain)]

Index: E:/projects/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
 ===================================================================
RCS file: /home/cvspublic/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java,v
 retrieving revision 1.6
diff -u -r1.6 DOMAttributeIterator.java
--- E:/projects/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java	10 \
                Aug 2002 16:13:04 -0000	1.6
+++ E:/projects/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java	30 \
Nov 2002 16:57:09 -0000 @@ -175,6 +175,8 @@
                         return attr;
                     }
                 }
+                // nothing found !
+                attr = null;
             }
             return attr;
         }


["NamespacedDOMAttributesBug.java" (application/octet-stream)]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic