You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Leicester <ma...@metering.co.nz> on 2002/02/05 23:08:46 UTC

Serialization of namespaces issue - after using org.apache.cocoon .xml.dom.DOMBuilder

Hi all,

I have just installed Cocoon 2.0.1 - after having used Cocoon 2.0 (and
earlier) for some time.
I had written a transformer which extracts fragments from a document exactly
along the lines of the FragmentExtractorTransformer which has worked well
for me in Cocoon 2.0 and before.

My class:
1. Extracts a fragment from the SAX stream to a DOM (using the
org.apache.cocoon.xml.dom.DOMBuilder class)
2. Performs some processing on this DOM
3. Creates SAX events from the processed DOM to put it back into the stream.

The issue I have seems to occur in the creation of the DOM representation.
If I serialize the created DOM I get my namespace prefixes in the output,
but I don't get the xmlns:some-namespace="some-URI" at all.

e.g. Using this as my input, and looking for extract-element = "node" with
extract-uri = "URI":

<parent>
	<x:node xmlns:x="URI"/>
</parent>

The <x:node> is extracted correctly to the DOM, but when I serialize the DOM
(say to System.out) I get:

<x:node/>

i.e. no xmlns definition, what I want is:

<x:node xmlns:x="URI"/>

getNamespaceURI() on the element also returns null, so I am assuming it is
in the DOM building, not the serialization.

Any ideas?

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

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