cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniele Madama" <d.mad...@pro-netics.com>
Subject Re: Problem with jxtg and sax
Date Wed, 17 Nov 2004 14:30:01 GMT
Hi,
sorry for this mail-spamming :D, but I'm trying to search the cause of
this problem, and I'm going more in deep in the code, so I arrived on
o.a.c.util.jxpath.DOMFactory, that was the factory passed on JXPathContext
when create a context for binding. In createObject() the node parent has
getPrefix() = null and the node name has correct prefix, now or there is a
problem in jxpath that doesn't take node in the rigth way, or I dont'
known where could be the problem.
As possible solution (delete the code on the previuos mail) I can only
suggest in DOMFactory.getNamespaceURI() somethings like this patch:

@@ -100,13 +100,19 @@

         while (tmp != null && tmp.getNodeType() == Node.ELEMENT_NODE) {
             element = (Element)tmp;
+
+            String elementPrefix = element.getPrefix();
+            int pos = element.getNodeName().indexOf(":");
+            if (elementPrefix == null && pos != -1) {
+                elementPrefix = element.getNodeName().substring(0, pos);
+            }

             // First test element prefixes
             if (prefix == null) {
-                if (element.getPrefix() == null) {
+                if (elementPrefix == null) {
                     return element.getNamespaceURI();
                 }
-            } else if(prefix.equals(element.getPrefix())) {
+            } else if(prefix.equals(elementPrefix)) {
                 return element.getNamespaceURI();
             }

WDYT?

TIA


-- 
Daniele Madama

Pro-netics s.r.l.
Via Elio Lampridio Cerva 127/c
Roma
Tel. 0651530849
http://www.pro-netics.com

Mime
View raw message