cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <coc...@leverageweb.com>
Subject Re: Cleaning up unused namespace declaration
Date Mon, 09 Feb 2004 16:41:51 GMT
Stefano Mazzocchi wrote:

> 
> 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.

Couldn't you also configure it to remove all ns without checking if you 
know your output should have no other namespaces (as usually the case 
with xhtml)?  That way you could avoid buffering in that special but 
common case.

Geoff


Mime
View raw message