com.novell.xsl.result
Class HTMLSerializer

java.lang.Object
  extended bycom.novell.xsl.result.SerializerImpl
      extended bycom.novell.xsl.result.XMLSerializer
          extended bycom.novell.xsl.result.HTMLSerializer
All Implemented Interfaces:
ResultHandler, Serializer

public class HTMLSerializer
extends XMLSerializer

Class to implement "html" output method of xsl:output element


Field Summary
 
Fields inherited from class com.novell.xsl.result.XMLSerializer
attributeNames, attributeValues, cdataOutput, children, currentNamespaces, elementCount, elementName, forceDTD, indentLevel, nodeType, noEscape, startTagOpen, stateStack, XML_SPACE_DEFAULT, XML_SPACE_PRESERVE, xmlSpace, xmlSpaceDefault, xmlSpacePreserve
 
Fields inherited from class com.novell.xsl.result.SerializerImpl
actualEncoding, options, stream, writer
 
Constructor Summary
HTMLSerializer()
          Construct a default HTML serializer
HTMLSerializer(OutputStream stream)
          Construct an XML serializer that will output to the passed stream
 
Method Summary
 void characters(String data)
          Receive notification of character data.
protected  void closeStartTag()
          Close any open element start tag
protected  void doIndent(int level)
          Indent up to indent level HTML output method doesn't do tabs
protected  void encodeHTML(String value, String specials, boolean isAttribute)
          encodes the passed string in HTML-format: '<', and '&' are replaced by "<" and "&" except when '&' is followed by '{', and except when '<' appears in an attribute value Any chars in value found in specials String will be replaced by character references In addition, any two-char UTF-16 surrogate chars are replaced by character references
protected  void initState()
          Initialize the state at the start of a document
protected  void outputHTMLAttributes()
          Output an HTML element's attribute
protected  void popState()
          Restore the last element state
 void processingInstruction(String target, String value)
          Receive notification of a processing instruction.
protected  void pushState()
          Save the current element state
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(String name, String namespaceURI)
          Receive notification of the beginning of an element.
protected  void writeDTD(String name)
          Write a DTD declaration.
protected  void writeHTMLattribute(String value)
          Writes the passed string as an HTML attribute
protected  void writeMeta()
          Write a META tag indicating content type and charset
protected  void writeURIattribute(String value)
          Perform recommended URI encoding for HTML 4.0
 
Methods inherited from class com.novell.xsl.result.XMLSerializer
attribute, comment, endDocument, endElement, getExpandedName, injectWhitespace, namespace, noTextEscaping, outputXMLAttribute, useCdataOutput
 
Methods inherited from class com.novell.xsl.result.SerializerImpl
getOptions, getStream, initWriter, setOptions, setStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.novell.xsl.result.Serializer
getOptions, getStream, setOptions, setStream
 

Constructor Detail

HTMLSerializer

public HTMLSerializer()
Construct a default HTML serializer


HTMLSerializer

public HTMLSerializer(OutputStream stream)
Construct an XML serializer that will output to the passed stream

Method Detail

startDocument

public void startDocument()
                   throws ResultException
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ResultHandler
Overrides:
startDocument in class XMLSerializer
Throws:
ResultException - if an implementation-dependent error occurs

startElement

public void startElement(String name,
                         String namespaceURI)
                  throws IllegalNameException,
                         IllegalNodeException,
                         ResultException
Receive notification of the beginning of an element.

Specified by:
startElement in interface ResultHandler
Overrides:
startElement in class XMLSerializer
Parameters:
name - the element's name
namespaceURI - the element's namespace uri
Throws:
IllegalNameException - if the specified element name is illegal
IllegalNodeException - if the current node cannot contain elements
ResultException - if an implementation-dependent error occurs

characters

public void characters(String data)
                throws IllegalNodeException,
                       ResultException
Receive notification of character data.

Specified by:
characters in interface ResultHandler
Overrides:
characters in class XMLSerializer
Parameters:
data - the character data
Throws:
IllegalNodeException - if the current node cannot contain character data
ResultException - if an implementation-dependent error occurs

processingInstruction

public void processingInstruction(String target,
                                  String value)
                           throws IllegalNameException,
                                  IllegalNodeException,
                                  ResultException
Receive notification of a processing instruction.

Specified by:
processingInstruction in interface ResultHandler
Overrides:
processingInstruction in class XMLSerializer
Parameters:
target - the processing instruction's target
value - the processing instruction's value, or null if there is no value
Throws:
IllegalNameException - if the specified target name is illegal
IllegalNodeException - if the current node cannot contain processing instructions
ResultException - if an implementation-dependent error occurs

writeDTD

protected void writeDTD(String name)
                 throws IOException
Write a DTD declaration.

Overrides:
writeDTD in class XMLSerializer
Parameters:
name - The name for the DTD
Throws:
IOException

writeMeta

protected void writeMeta()
                  throws IOException
Write a META tag indicating content type and charset

Throws:
IOException

closeStartTag

protected void closeStartTag()
                      throws IOException,
                             ResultException
Close any open element start tag

Overrides:
closeStartTag in class XMLSerializer
Throws:
IOException
ResultException

outputHTMLAttributes

protected void outputHTMLAttributes()
                             throws IOException
Output an HTML element's attribute

Throws:
IOException

writeHTMLattribute

protected void writeHTMLattribute(String value)
                           throws IOException
Writes the passed string as an HTML attribute

Parameters:
value - The value to write
Throws:
IOException

encodeHTML

protected void encodeHTML(String value,
                          String specials,
                          boolean isAttribute)
                   throws IOException
encodes the passed string in HTML-format: '<', and '&' are replaced by "<" and "&" except when '&' is followed by '{', and except when '<' appears in an attribute value Any chars in value found in specials String will be replaced by character references In addition, any two-char UTF-16 surrogate chars are replaced by character references

Parameters:
value - string to convert to HTML format
specials - collection of chars to use char references for
Throws:
IOException

writeURIattribute

protected void writeURIattribute(String value)
                          throws IOException
Perform recommended URI encoding for HTML 4.0

Parameters:
value - The attribute value
Throws:
IOException

initState

protected void initState()
Initialize the state at the start of a document

Overrides:
initState in class XMLSerializer

doIndent

protected void doIndent(int level)
                 throws IOException
Indent up to indent level HTML output method doesn't do tabs

Overrides:
doIndent in class XMLSerializer
Parameters:
level - Number of tabs to output
Throws:
IOException

pushState

protected void pushState()
Save the current element state

Overrides:
pushState in class XMLSerializer

popState

protected void popState()
Restore the last element state

Overrides:
popState in class XMLSerializer