Hi 

I think I have found a bug in session-fw block. However I am amazed why nobody 
else has found it yet !

I have already reported it as a bug in bugzilla (Sorry, should have discussed 
it here first according to Contribution document, but
I didn't see that at first)

http://issues.apache.org/bugzilla/show_bug.cgi?id=36471

In short: 
Transforming <session:getxml ... > doesn't return text elements. Therefore 
<session:getxml context="authentication" path="/authentication/ID"/>
doesn't work. However this works :
<session:getxml context="authentication" path="/authentication/" />

I have already found out how to fix it. Attached to this mail you find the 
patch.

Not sure if this is the best way of fixing it or if the real problem is the 
includeNode method of
org.apache.cocoon.xml.IncludeXMLConsumer. 

Regards,
Armaz Mellati
Index: C:/Documents and 
Settings/armaz/workspace/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/SimpleSessionContext.java
===================================================================
--- C:/Documents and 
Settings/armaz/workspace/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/SimpleSessionContext.java
       (revision 267169)
+++ C:/Documents and 
Settings/armaz/workspace/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/SimpleSessionContext.java
       (working copy)
@@ -42,7 +42,7 @@
  *  This is a simple implementation of the session context.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: SimpleSessionContext.java,v 1.9 2004/03/19 14:16:55 
cziegeler Exp $
+ * @version CVS $Id$
 */
 public final class SimpleSessionContext
 implements SessionContext {
@@ -389,8 +389,14 @@
                     // stream all children of this element to the resulting 
tree
                     NodeList childs = list.item(i).getChildNodes();
                     if (childs != null) {
-                        for(int m = 0; m < childs.getLength(); m++) {
-                            IncludeXMLConsumer.includeNode(childs.item(m), 
contentHandler, lexicalHandler);
+                        for(int m = 0; m < childs.getLength(); m++) {          
                
+                        Node node=childs.item(m);
+                       if (node.getNodeType()==Node.TEXT_NODE){
+                               String value = node.getNodeValue();
+                               contentHandler.characters(value.toCharArray(), 
0, value.length());
+                       }else{
+                               IncludeXMLConsumer.includeNode(node, 
contentHandler, lexicalHandler);
+                       }
                         }
                     }
                 }

Reply via email to