cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Krulewitz <>
Subject Re: Serializers issues...
Date Tue, 20 Apr 2004 15:12:41 GMT
Hi Pier --

Pier Fumagalli wrote:
> I basically fixed the GARBAGE serializers to work now cleanly as cocoon 
> serializers, simple job, but as far as we could see, the new ones work 
> much _MUCH_ better than Xalan's own (they might be slower, but they're 
> more compliant).

I've been using your XHTMLSerializer as a Cocoon serializer for a little 
while now on the project I'm developing, and I can report that it has 
been working very well (although I have not yet tested it in 
production).  Since I am very concerned with the way the XHTML looks, I 
added the following features to the XHTMLSerializer and XMLSerializer:

- Option to omit xml declaration
- Option to omit xml namespace declaration
- Option to omit meta tag
- Explicitly set which namespaces are declared on the root element, and 
prevent these namepsaces from being declared later in the document.
- Option to declare other namespaces
- Intending, including the ability to indent some elements, and put a 
break after some elements.  This lets you have a document that looks like:

   <title>this is the title</title>
     <p>a paragraph</p>

I would also like to do some work with whitespace minimization, but 
haven't really looked into it yet.

- Option to enable compatibility mode as described in:

This determines the treatment of empty elements that are not declared as 
EMPTY, as you already implemented.  It would be nice to extend this to 
include all of the compatibility guidelines.  I also tried implementing 
an "auto" mode that could detect if compatible content should be served 
(e.g. if the browser is IE), but could not figure out how to 1) read the 
User-Agent in the serializer, or 2) change the content type of the 
response on a per-request basis.

To make a Cocoon serializer out of the XHTMLSerializer, I took the 
simple solution and just wrapped it around a new AbstractSerializer 
subclass.  There probably is a better way.

You are absolutely welcome to all of this code that I have added (there 
really wasn't much added thanks to your clean design).  I was planning 
on cleaning this up and offering it back to the community, but I have 
not had the time.

Thanks again for the code!


View raw message