cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasha Joachimsthal <j.joachimst...@onehippo.com>
Subject Re: HTML5 doctype from Cocoon 2.1?
Date Wed, 17 Nov 2010 06:06:58 GMT
You can either extend the HTMLSerializer, the XHTMLSerializer or both. HTML5
allows the output to be valid XML or just plain old tagsoup.
http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/

Jasha Joachimsthal

j.joachimsthal@onehippo.com - jasha@apache.org

Hippo
Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20 522
4466
USA  • San Francisco  185 H Street Suite B  •  Petaluma CA 94952-5100 •  +1
(707) 773 4646
Canada    •   Montréal  5369 Boulevard St-Laurent #430  •  Montréal QC H2T
1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com


On 17 November 2010 00:12, Martin Holmes <mholmes@uvic.ca> wrote:

> Thanks Alec -- I think I might be able to manage an HTML5 serializer if I
> have a good example to work from. I'm puzzled about why you needed your
> custom serializer, though -- I've been able to serialize XHTML 1.1 without
> problems, using the regular serializer configured just like yours below.
> What does your dynamic serializer do that can't be done with a regular one?
>
> Cheers,
> Martin
>
>
> On 10-11-16 01:05 AM, Alec Bickerton wrote:
>
>> The code below is part of a seperate serialiizer class that extands
>> HTMLSerializer and implements SitemapModelComponent.
>> It's configered in the sitemap as shown.
>>
>> <map:serializer name="xhtml-flexible" logger="sitemap.serializer.xhtml"
>> mime-type="application/xhtml+xml; charset=utf-8"
>> pool-grow="2" pool-max="64"     pool-min="2"
>> src="ch.example.cocoon.serializer.DynamicSerializer">
>>        <indent>yes</indent>
>>        <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public>
>>        <doctype-system>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
>> </doctype-system>
>>        <encoding>UTF-8</encoding>
>> </map:serializer>
>>
>> Regards,
>> Alec
>>
>> On 15/11/10 17:09, Martin Holmes wrote:
>>
>>> Hi there,
>>>
>>> Where exactly did you put this code? Did you implement your serializer
>>> as a separate class file, or have you modified the core Cocoon code?
>>>
>>> (I have no experience of customizing Cocoon itself, although I've
>>> written the odd class to implement custom sorting collations and to add
>>> functionality to XQuery code.)
>>>
>>> Cheers,
>>> Martin
>>>
>>> On 10-11-15 01:08 AM, Alec Bickerton wrote:
>>>
>>>> Hi,
>>>>
>>>> Just to throw in my 0.02c. At my current workplace we solved this
>>>> issue by implementing both a dynamic XML Serializer
>>>> and an HTML Serializer. We found that reconfiguring a the serializer
>>>> for each use while risky does work.
>>>>
>>>> Caveat: While this approach has been tested under light load. I cannot
>>>> say how it'll behave under heavy load, we're
>>>> still checking. YMMV.
>>>>
>>>>      public void setup(SourceResolver resolver, Map objectModel,
>>>>> String src, Parameters par) {
>>>>>         String configxml = "";
>>>>>         String[] parameterNames = par.getNames();
>>>>>         for (int i = 0; i<   parameterNames.length; i++) {
>>>>>             String paramName = parameterNames[i];
>>>>>             String paramValue = par.getParameter(paramName, null);
>>>>>             if (!paramName.isEmpty()&&   paramValue != null)
>>>>>                 configxml += "<" + paramName +">" + paramValue
+"</"
>>>>> + paramName + ">";
>>>>>         }
>>>>>         if (configxml.length()>   0) {
>>>>>             configxml = "<settings>" + configxml +"</settings>";
//
>>>>> put settings around to make an 'xml'
>>>>>             try {
>>>>>                 DefaultConfigurationBuilder confBuilder = new
>>>>> DefaultConfigurationBuilder();
>>>>>                 ByteArrayInputStream stream = new
>>>>> ByteArrayInputStream(configxml.getBytes());
>>>>>                 Configuration conf = confBuilder.build(stream);
>>>>>                 /****
>>>>>                  * all these values are supported - see
>>>>> AbstractTextSerializer cdata-section-elements doctype-public
>>>>>                  * doctype-system encoding indent media-type method
>>>>> omit-xml-declaration standalone version
>>>>>                  ***************************************/
>>>>>                 super.configure(conf);
>>>>>             } catch (ConfigurationException e) {
>>>>>                 log.error("ConfigurationException: " +
>>>>> e.getLocalizedMessage(), e);
>>>>>             } catch (SAXException e) {
>>>>>                 log.error("SAXException: " + e.getLocalizedMessage(),
>>>>> e);
>>>>>             } catch (IOException e) {
>>>>>                 log.error("IOException: " + e.getLocalizedMessage(),
>>>>> e);
>>>>>             }
>>>>>         }
>>>>>     }
>>>>>
>>>>
>>>>
>>>> On 15/11/10 05:31, Jos Snellings wrote:
>>>>
>>>>> Hi Martin,
>>>>>
>>>>> Do not know details, but it might help if you use the xsl:output
>>>>> element
>>>>> in your transformation.
>>>>> There is hope that it would not be overridden by the serializer.
>>>>>
>>>>> <xsl:output
>>>>> method="xml|html|text|name"
>>>>> version="string"
>>>>> encoding="string"
>>>>> omit-xml-declaration="yes|no"
>>>>> standalone="yes|no"
>>>>> doctype-public="string"
>>>>> doctype-system="string"
>>>>> cdata-section-elements="namelist"
>>>>> indent="yes|no"
>>>>> media-type="string"/>
>>>>>
>>>>> Cheers,
>>>>> Jos
>>>>>
>>>>>
>>>>> On 11/12/2010 05:17 PM, Martin Holmes wrote:
>>>>>
>>>>>> Hi there,
>>>>>>
>>>>>> Does anyone know how to configure a serializer for Cocoon 2.1 that
>>>>>> will output an HTML5 document? That means a minimal doctype that
looks
>>>>>> like this:
>>>>>>
>>>>>> <!DOCTYPE html>
>>>>>>
>>>>>> served as text/html.
>>>>>>
>>>>>> Cheers,
>>>>>> Ma
>>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Mime
View raw message