org.apache.cocoon.components.serializers
Class HTMLSerializer

java.lang.Object
  extended by org.apache.cocoon.components.serializers.EncodingSerializer
      extended by org.apache.cocoon.components.serializers.XMLSerializer
          extended by org.apache.cocoon.components.serializers.XHTMLSerializer
              extended by org.apache.cocoon.components.serializers.HTMLSerializer
All Implemented Interfaces:
Poolable, Recyclable, Component, Configurable, Serializer, SitemapOutputComponent, XMLConsumer, ContentHandler, LexicalHandler, Locator

public class HTMLSerializer
extends XHTMLSerializer

A serializer converting XHTML into plain old HTML.

For configuration options of this serializer, please look at the XHTMLSerializer and EncodingSerializer.

Any of the XHTML document type declared or used will be converted into its HTML 4.01 counterpart, and in addition to those a "compatible" doctype can be supported to exploit a couple of shortcuts into MSIE's rendering engine. The values for the doctype-default can then be:

"none"
Not to emit any dococument type declaration.
"compatible"
The HTML 4.01 Transitional (exploiting MSIE shortcut).
"strict"
The HTML 4.01 Strict document type.
"loose"
The HTML 4.01 Transitional document type.
"frameset"
The HTML 4.01 Frameset document type.

Version:
CVS $Id: HTMLSerializer.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
static DocType HTML401_DOCTYPE_COMPATIBLE
          A cross-browser compatible very simple document type declaration.
static DocType HTML401_DOCTYPE_FRAMESET
          A representation of the HTML 4.01 frameset document type.
static DocType HTML401_DOCTYPE_STRICT
          A representation of the HTML 4.01 strict document type.
static DocType HTML401_DOCTYPE_TRANSITIONAL
          A representation of the HTML 4.01 transitional document type.
 
Fields inherited from class org.apache.cocoon.components.serializers.XHTMLSerializer
doctype_default, encodeCharacters, XHTML1_DOCTYPE_FRAMESET, XHTML1_DOCTYPE_STRICT, XHTML1_DOCTYPE_TRANSITIONAL, XHTML1_NAMESPACE
 
Fields inherited from class org.apache.cocoon.components.serializers.XMLSerializer
doctype
 
Fields inherited from class org.apache.cocoon.components.serializers.EncodingSerializer
ATTRIBUTE_LENGTH, ATTRIBUTE_LOCAL, ATTRIBUTE_NSURI, ATTRIBUTE_QNAME, ATTRIBUTE_VALUE, charset, indentPerLevel, namespaces
 
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
 
Constructor Summary
HTMLSerializer()
          Create a new instance of this HTMLSerializer
 
Method Summary
 void body(String nsuri, String local, String qual)
          Receive notification of the beginning of the document body.
 void configure(Configuration conf)
          Configure this instance by selecting the default document type to use.
 void endElementImpl(String nsuri, String local, String qual)
          Receive notification of the end of an element.
 void head()
          Write the XML document header.
 void startElementImpl(String nsuri, String local, String qual, String[][] namespaces, String[][] attributes)
          Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.components.serializers.XHTMLSerializer
encode, getMimeType, isCdataElement
 
Methods inherited from class org.apache.cocoon.components.serializers.XMLSerializer
charactersImpl, closeElement, comment, endCDATA, endDocument, endDTD, endEntity, ignorableWhitespace, processingInstruction, recycle, skippedEntity, startCDATA, startDocument, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.components.serializers.EncodingSerializer
characters, encode, encode, endElement, endPrefixMapping, flush, getColumnNumber, getLineNumber, getLocation, getPublicId, getSystemId, setDocumentLocator, setOutputStream, shouldSetContentLength, startElement, startPrefixMapping, write, write, write, write, write, writeIndent, writeln, writeln
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML401_DOCTYPE_COMPATIBLE

public static final DocType HTML401_DOCTYPE_COMPATIBLE
A cross-browser compatible very simple document type declaration.


HTML401_DOCTYPE_STRICT

public static final DocType HTML401_DOCTYPE_STRICT
A representation of the HTML 4.01 strict document type.


HTML401_DOCTYPE_TRANSITIONAL

public static final DocType HTML401_DOCTYPE_TRANSITIONAL
A representation of the HTML 4.01 transitional document type.


HTML401_DOCTYPE_FRAMESET

public static final DocType HTML401_DOCTYPE_FRAMESET
A representation of the HTML 4.01 frameset document type.

Constructor Detail

HTMLSerializer

public HTMLSerializer()
Create a new instance of this HTMLSerializer

Method Detail

configure

public void configure(Configuration conf)
               throws ConfigurationException
Configure this instance by selecting the default document type to use.

Specified by:
configure in interface Configurable
Overrides:
configure in class XHTMLSerializer
Throws:
ConfigurationException

head

public void head()
          throws SAXException
Write the XML document header.

This method overrides the default XMLSerializer.behaviour.

Overrides:
head in class XHTMLSerializer
Throws:
SAXException

body

public void body(String nsuri,
                 String local,
                 String qual)
          throws SAXException
Receive notification of the beginning of the document body.

Overrides:
body in class XHTMLSerializer
Parameters:
nsuri - The namespace URI of the root element.
local - The local name of the root element.
qual - The fully-qualified name of the root element.
Throws:
SAXException

startElementImpl

public void startElementImpl(String nsuri,
                             String local,
                             String qual,
                             String[][] namespaces,
                             String[][] attributes)
                      throws SAXException
Receive notification of the beginning of an element.

Overrides:
startElementImpl in class XHTMLSerializer
Parameters:
nsuri - The namespace URI of the root element.
local - The local name of the root element.
qual - The fully-qualified name of the root element.
namespaces - An array of String objects containing the namespaces to be declared by this element.
attributes - An array of String objects containing all attributes of this element.
Throws:
SAXException

endElementImpl

public void endElementImpl(String nsuri,
                           String local,
                           String qual)
                    throws SAXException
Receive notification of the end of an element.

Overrides:
endElementImpl in class XHTMLSerializer
Parameters:
nsuri - The namespace URI of the root element.
local - The local name of the root element.
qual - The fully-qualified name of the root element.
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.