Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 63829 invoked from network); 20 Apr 2004 16:00:55 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 20 Apr 2004 16:00:55 -0000 Received: (qmail 74497 invoked by uid 500); 20 Apr 2004 16:00:43 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 74447 invoked by uid 500); 20 Apr 2004 16:00:43 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 74432 invoked from network); 20 Apr 2004 16:00:42 -0000 Received: from unknown (HELO l3dns1.vnu.co.uk) (62.140.213.135) by daedalus.apache.org with SMTP; 20 Apr 2004 16:00:42 -0000 Received: from [10.11.155.41] (155-41.static.int.vnu.co.uk [10.11.155.41]) by l3dns1.vnu.co.uk (Postfix) with ESMTP id 3017029CF6 for ; Tue, 20 Apr 2004 17:00:45 +0100 (BST) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <40853DE9.5090407@mm.st> References: <40853DE9.5090407@mm.st> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-3--1057073799; protocol="application/pkcs7-signature" Message-Id: From: Pier Fumagalli Subject: Re: Serializers issues... Date: Tue, 20 Apr 2004 17:00:24 +0100 To: dev@cocoon.apache.org X-Mailer: Apple Mail (2.613) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Apple-Mail-3--1057073799 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 20 Apr 2004, at 16:12, Steve Krulewitz wrote: > 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 Nice feature! > - Option to omit xml namespace declaration That's absolutely brillant... > - Option to omit meta tag Hehehe! :-) I think you noticed the same one I did: http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/webapp/welcome.xslt? annotate=1.11#37 That "meta" tag scares me, as it assumes that the content is serialized in XHTML with UTF-8 > - Explicitly set which namespaces are declared on the root element, > and prevent these namepsaces from being declared later in the > document. Oh, that's pretty! :-) > - 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: > > > > this is the title > > >
>

a paragraph

>
> > > > I would also like to do some work with whitespace minimization, but > haven't really looked into it yet. You might want to specialize the HTML serializer to strip the unneded whitespace and re-indent it "nicely", kinda like a very pretty-printer serializer > - Option to enable compatibility mode as described in: > > http://www.w3.org/TR/xhtml1/#guidelines > > 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. Ah.... > 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. I removed some of the methods (setOutput, getContentType) and replaced them with the Cocoon's own, (getMimeType, setOutputStream, ...) and implented the configurable interface for the encoding... Two hours work, but working... Also, I've changed the package to be org.apache.cocoon.components.serializers.(XML|XHTML|HTML)Serializer, and cleaned up the code a bit... Included them into a nice block with simple configurations (it automatically puts them into the root sitemap, now), and as you might have noticed, added a number of extra charset encoders for more i18n support (those are automagically generated, so, it's no biggie). > 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. That's great to hear! :-) If you could include your changes once I put them in CVS it would be absolutely fantastic... You might have to do a little bit of mangling including them as a couple of methods have changed (and maybe a direct patch of the source might fail) but my changes were so trivial that the core bulk of the entire design is still there, untouched. Pier --Apple-Mail-3--1057073799 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGHDCCAtUw ggI+oAMCAQICAwttIjANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDQwMTA3MDE0MjIwWhcNMDUwMTA2MDE0MjIwWjBGMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSMwIQYJKoZIhvcNAQkBFhRwaWVyQGJldGF2ZXJzaW9u Lm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMC/E+M4UqeEBnSTj0AIMX9oMWSo 9Te7VUPPvINPSKKLEElGaottQeJaYRSlfGIjUyXkzTlbw0MFAPaqfU97t+5xeNkighKu7ZcVIPfz AARv5+wp+gON5uSNV2GzP0rPwAbUDIG2zaSonJlN7whVG5fO9G1u0oYaWolpgKUAc3T5P5Gv737L G1iSxrnl9DQlVDIuZWrcgWYX/MFFlf7prXXm6lS08lYhGi0NrIf5SploZzMG+uHHzVDgV8WCTQr1 hXB825VLhnWw4GPFx5qLVgElctVz88S/+t8O/+1kRf3ky8SsewfyCTuDAk4XHzfb7M5bECiZ1yni dhW+sD1y/TsCAwEAAaMxMC8wHwYDVR0RBBgwFoEUcGllckBiZXRhdmVyc2lvbi5vcmcwDAYDVR0T AQH/BAIwADANBgk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