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?
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com