You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bruce Krautbauer <br...@medtronic.com> on 2002/06/13 19:53:39 UTC

Session transformer and namespaces

This input:

<?xml version="1.0" ?>
<test>
	<createcontext xmlns="http://cocoon.apache.org/session/1.0" name="sessionTest" />
	<setxml xmlns="http://cocoon.apache.org/session/1.0" context="sessionTest" path="/root">
		<a xmlns="http://namespace.org/a">foo</a>
		<b>bar</b>
	</setxml>
	<getxml xmlns="http://cocoon.apache.org/session/1.0" context="sessionTest" path="/"/>
</test>

creates the following invalid XML output (there are multiple xmlns attributes on the 'root' element):

<?xml version="1.0" encoding="UTF-8"?>
<test>
	<root xmlns="http://cocoon.apache.org/session/1.0" xmlns="http://cocoon.apache.org/session/1.0" xmlns="http://cocoon.apache.org/session/1.0">
		<a>foo</a>
		<b>bar</b>
	</root>
</test>

also note the namespace for the 'a' element has disappeared.

The following takes care of the 'root' element problem, but the 'a' element problem remains:

<?xml version="1.0" ?>
<test xmlns:session="http://cocoon.apache.org/session/1.0">
	<session:createcontext name="sessionTest" />
	<session:setxml context="sessionTest" path="/root">
		<a xmlns="http://namespace.org/a">foo</a>
		<b>bar</b>
	</session:setxml>
	<session:getxml context="sessionTest" path="/"/>
</test>

I am creating my input to the session transformer with the XSLT transformer using <element name="setxml" namespace="http://cocoon.apache.org/session/1.0">... and this is why I ran into the first problem.

Does anyone have any ideas on how to work around this?

Running CVS HEAD on Tomcat 4.0.4-b2 using JDK 1.3.1_02.

Thanks,
Bruce



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Session transformer and namespaces

Posted by Jeremy Quinn <sh...@mac.com>.
On Thursday, June 13, 2002, at 06:53 PM, Bruce Krautbauer wrote:

> also note the namespace for the 'a' element has disappeared.
>

The transformer you are using is based on the 
AbstractSAXTransformer, which I believe does not handle 
namespaces properly.

I have the same problem with the new SourceWritingTransformer 
version I am working on, that is also based on the same class.


regards Jeremy


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>