A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/896.html

Document ID: 896
Branch: main
Language: default
Name: HTMLSerializer (unchanged)
Document Type: Sitemap Component (unchanged)
Updated on: 9/27/08 11:08:21 PM
Updated by: David Legg

A new version has been created, state: draft

Parts
=====

Long description
----------------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 5106 bytes (previous version: 4456 bytes)
Content diff:
    <html>
    <body>
    
    <p>The HTMLSerializer is used to render the final output of a Cocoon 
pipeline as
--- HTML; suitable for a web browser to understand.</p>
+++ HTML; suitable for a web browser to read.</p>
    
+++ <p class="note">There are currently two different implementations of the
+++ HTMLSerializer.  This page documents the older one which is supplied by the 
core
+++ block and which uses the Xalan html output method.  The newer version can be
+++ found in the cocoon-serializers block, implemented in the class:
+++ 'org.apache.cocoon.components.serializers.HTMLSerializer'.  The newer 
version
+++ has different configuration settings and dependencies which are not 
documented
+++ here.</p>
+++ 
    <p>Though HTML and XML look similar there are a number of subtle 
differences. 
    The standard HTMLSerializer actually delegates the job of transformation to 
the
--- JAXP (Java API for XML Parsing) 'html' output method.  By default in Cocoon 
this
+++ JAXP (Java API for XML Parsing) html output method.  By default in Cocoon 
this
    is implemented by the Xalan processor (though other XSLT processors can be
    used).  This method performs the following actions: -</p>
    
    <ul>
--- <li>Certain empty tags are not closed.  For example &lt;br/&gt; or
--- &lt;br&gt;&lt;/br&gt; elements will be output as &lt;br&gt;.  For HTML 4.01 
the
--- empty elements are: <em>area</em>, <em>base</em>, <em>basefont</em> ,<em>
--- br</em> , <em>col</em>,<em> frame</em>, <em>hr</em> , <em>img</em>,
--- <em>input</em>, <em>isindex</em>, <em>link</em>, <em>meta </em>and
--- <em>param</em>.  Note that some of these tags are deprecated in some 
versions of
--- HTML.</li>
--- <li>Tags are considered to be case insensitive.  Therefore &lt;br/&gt; or
+++ <li>Unlike XML, HTML requires certain tags to have empty bodies and remain
+++ unclosed.  For example &lt;br/&gt; or &lt;br&gt;&lt;/br&gt; elements will be
+++ output as &lt;br&gt;.  For HTML 4.01 the tags requiring this treatment are:
+++ <em>area</em>, <em>base</em>, <em>basefont</em> ,<em> br</em> ,
+++ <em>col</em>,<em> frame</em>, <em>hr</em> , <em>img</em>, <em>input</em>,
+++ <em>isindex</em>, <em>link</em>, <em>meta </em>and <em>param</em>.  Note 
that
+++ some of these tags are also deprecated in some versions of HTML.</li>
+++ <li>HTML tags are case insensitive.  Therefore &lt;br/&gt; or
    &lt;BR&gt;&lt;/BR&gt; or &lt;Br&gt;&lt;/Br&gt; will all be recognized as the
    html br tag and be output as &lt;br&gt; with no end tag.</li>
    <li>Any content between <em>script </em>or <em>style </em>tags is not 
escaped. 
(13 equal lines skipped)
    whatever source it is fed.  For example, if you specify the output should be
    strict HTML 4.01 and then your input contains: &lt;img src="pic.jpg"
    align="right"/&gt; the align attribute will still be output even though it 
is
--- deprecated in strict HTML 4.01.</p>
+++ deprecated in strict HTML 4.01 (because it is considered to be a 
presentational
+++ element).</p>
    
    <h2>Configuration</h2>
    
--- <p>By default an HTMLSerializer is assigned to the type name 'html' and
+++ <p>By default an HTMLSerializer is assigned to the sitemap name 'html' and
    configured to produce HTML 4.01 'loose' (also known as 'HTML 4.01
    Transitional').  This doctype allows the use of both structural, semantic 
and
    presentational elements (e.g. font) but not framesets.  The default HTML
--- serializer can be used in a pipeline by adding a suitable map:serialize
--- statement to your sitemap.xmap file as follows:</p>
+++ serializer can be used as the last component in a pipeline by adding a 
suitable
+++ &lt;map:serialize&gt; tag to your sitemap.xmap file as follows:</p>
    
    <pre>&lt;map:pipeline id="demo"&gt;
      &lt;map:match pattern="*.html"&gt;
(3 equal lines skipped)
    &lt;/map:pipeline&gt;
    </pre>
    
--- <p>If you wish to change the default settings you will need to create a
--- Springbean and place it in a directory where it can be picked up at 
application
--- launch.  The following example Springbean file shows how to change the 
default
--- to produce HTML 4.01 strict output:</p>
+++ <p>If you wish to further configure the default settings you will need to 
create
+++ a Springbean definition file and place it in a directory where it can be 
picked
+++ up at application launch.  The following example Springbean file shows how 
to
+++ change the default to produce HTML 4.01 strict output:</p>
    
    <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;beans xmlns="http://www.springframework.org/schema/beans";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xmlns:pipeline="http://cocoon.apache.org/schema/pipeline";
---        xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
---                            http://cocoon.apache.org/schema/pipeline 
http://cocoon.apache.org/schema/pipeline/cocoon-pipeline-1.0.xsd";
+++        xsi:schemaLocation=
+++          "http://www.springframework.org/schema/beans
+++           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+++           http://cocoon.apache.org/schema/pipeline
+++           http://cocoon.apache.org/schema/pipeline/cocoon-pipeline-1.0.xsd";
           default-init-method="init"&gt;
    
      &lt;!--
        - HTML 4.01 Strict Serializer
        --&gt;
---   &lt;bean name="org.apache.cocoon.serialization.Serializer/html" 
class="org.apache.cocoon.serialization.HTMLSerializer"
---         scope="prototype" 
parent="org.apache.cocoon.serialization.AbstractTextSerializer"&gt;
+++   &lt;bean
+++     name="org.apache.cocoon.serialization.Serializer/html"
+++     class="org.apache.cocoon.serialization.HTMLSerializer"
+++     scope="prototype"
+++     parent="org.apache.cocoon.serialization.AbstractTextSerializer"&gt;
        &lt;pipeline:component mime-type="text/html;charset=utf-8"/&gt;
        &lt;property name="format"&gt;
          &lt;props&gt;
(13 equal lines skipped)