On 9 Feb 2004, at 04:40, Sylvain Wallez wrote:


Stefano Mazzocchi wrote:

I'm not normally bugged by namespace declarations which aren't used, but boy, something like this just can't go on without me to do something about it:

<br xmlns:dir="http://apache.org/cocoon/directory/2.0"; xmlns:include="http://apache.org/cocoon/include/1.0"/>

[taken from my blog output]

do you have any suggestions on how to use the xml serializer so that it stops doing that?


A long time ago, I wrote a NamespaceNormalizer that works in two steps:
1 - record all SAX events (using XMLByteStreamCompiler) except namespace declarations which are stored separately,
2 - replay SAX events, declaring all namespaces before the root element.


This leads to buffering the document, which has a cost, but wouldn't hurt when the pipeline can be cached.

We could add this as an optional feature of the XMLSerializer.

WDYT?

I think it would *rock*! I wouldn't mind paying the cost of such a buffering since I'm going to cache this anyway.


--
Stefano.



Reply via email to