You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Legg <da...@searchevent.co.uk> on 2008/09/25 17:31:25 UTC

Re: [C2.2] Overriding default properties? - SOLVED

I wrote:

> I'm a little confused about the best way to change or override default 
> settings for properties in Cocoon 2.2.

I'm less confused now ;-)

> Out of the box the 'html' serializer is set to produce Transitional 
> 4.01 HTML.  So if I put the following in sitemap.xmap:
>  ...
>    <map:serialize type="html"/>
>  ...
> then that's what I get.
>
> Now if I try overriding the defaults by explicitly adding extra 
> parameters to the sitemap as follows:
>  ...
>    <map:serialize type="html">
>      <doctype-public>-//W3C//DTD HTML 4.01//EN</doctype-public>
>      
> <doctype-system>http://www.w3.org/TR/html4/strict.dtd</doctype-system>
>    </map:serialize>
>  ...
> I get no change in the output.  Is this because the spring beans which 
> define the default settings have a higher priority than the sitemap?

I realize now that doing things this way is the 'old' or pre-cocoon 2.2 
way and I must empty my head of such thoughts!

As an experiment I located the following file:

  
[cocoontrunk]/core/cocoon-pipeline/cocoon-pipeline-components/src/main/resources/META-INF/cocoon/spring/cocoon-core-serializers.xml

which I believe to be the file responsible for setting the default 
properties of the 'xml', 'html' and 'xhtml' serializers as well as some 
others.  I then copied this file to my own block here:

  [myblock]/src/main/resources/META-INF/cocoon/spring/serializers.xml

I then edited this file to remove all the other bean definitions except 
the one with the name: 
'org.apache.cocoon.serialization.Serializer/html'.  I also changed the 
doctype-public and doctype-system to the HTML 4.01 strict definition.  
After restarting my C2.2 application I was pleased to see that the 
pipeline which had been outputting 4.01 loose doctype was now outputting 
4.01 strict HTML as required.

So it works!  I have successfully overridden the default config for a 
Cocoon component without having to resort to the sitemap.xmap file.  
Having read other user's comments on this I can see how useful this is.

Regards,
David Legg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org