cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject NS problems with AbstractSAXTransformer & SourceWritingTransformer
Date Sun, 02 Jun 2002 14:30:56 GMT
Hi All,

SourceWritingTransformer in HEAD is broken, I am working on it.

It's not committed yet, but I have a version here that has the 
<source:write/> tag implemented using the same pattern as the 
new <source:insert/> tag Carsten added.

So now the <source:write/> tag also uses the 
AbstractSAXTransformer.startRecording() method to buffer the 
content to be written to a org.w3c.dom.DocumentFragment, writing 
it to source when the tag closes.

I got it working with <slash-edit/> last night and this morning 
started work on the tests.

I found a rather nasty problem with test2, the namespace test.

The results are odd.

This is the Fragment as it starts out. You can tell from the log 
transformer that the all expected events are sent.

   <page xmlns:xl="">
     <title>SourceWritingTransformer Test Result 2</title>
       <para><link xl:to="test/2">I am in the XLink 

This is the report in the sitemap.log showing the content of the 
captured DOM fragment (the code uses 
XMLUtils.serializeNodeToXML() to log the fragment).

The xmlns declaration has moved from the <page/> to the <link/> 
tag, was the <page/>'s startPrefixMapping registered during the 
capture process?

     <title>SourceWritingTransformer Test Result 2</title>
   <link xmlns:xl="" xl:to="test/2">I 
am in the XLink NameSpace</link>

This is the content that get's written to file.
Now the namespace declaration has gone completely, meaning the 
file cannot even be parsed.

     <title>SourceWritingTransformer Test Result 2</title>
       <para><link xl:to="test/2">I am in the XLink 

SourceWritingTransformer copies the DocumentFragment into a new 
Document thus:

   Parser parser = (Parser)this.manager.lookup(Parser.ROLE);
   Document resource = parser.createDocument();
   Node importNode = resource.importNode(fragment, true);

Then uses the DOMStreamer to output to Source.

Have I missed something?

There might be a general problem with AbstractSAXTransformer, 
because I tried to <source:insert/> a fragment containing a 
namespace declaration, and that got lost too.

Thanks for any suggestions

regards Jeremy

To unsubscribe, e-mail:
For additional commands, email:

View raw message