com.icl.saxon.output

Class HTMLEmitter

Implemented Interfaces:
Result

public class HTMLEmitter
extends XMLEmitter

This class generates HTML output
Author:
Michael H. Kay

Field Summary

(package private) static HashMap
emptyTags
Table of HTML tags that have no closing tag

Fields inherited from class com.icl.saxon.output.XMLEmitter

attbuff1, characterSet, declarationIsWritten, docTypeWritten, empty, escaping, lastDisplayName, lastNameCode, lastPrefix, lastURI, openStartTag, preferHex, specialInAtt, specialInText

Fields inherited from class com.icl.saxon.output.Emitter

locator, namePool, outputProperties, outputStream, systemId, writer

Constructor Summary

HTMLEmitter()
Constructor

Method Summary

void
characters(char[] ch, int start, int length)
Character data.
void
endElement(int nameCode)
Output an element end tag.
protected static boolean
isEmptyTag(String tag)
static boolean
isUrlAttribute(String element, String attribute)
void
processingInstruction(String target, String data)
Handle a processing instruction.
void
startDocument()
Output start of document
void
startElement(int nameCode, Attributes atts, int[] namespaces, int nscount)
Output element start tag
protected void
writeAttribute(int elCode, String attname, String type, String value)
Write attribute name=value pair.
protected void
writeEscape(ch[] , int start, int length, boolean inAttribute)
Escape characters.

Methods inherited from class com.icl.saxon.output.XMLEmitter

characters, closeStartTag, comment, emptyElementTagCloser, endDocument, endElement, outputCharacterReference, processingInstruction, setDocumentLocator, setEscaping, setOutputProperties, setResult, setUnparsedEntity, startDocument, startElement, testCharacters, testCharacters, writeAttribute, writeDeclaration, writeDocType, writeEscape

Methods inherited from class com.icl.saxon.output.Emitter

characters, comment, endDocument, endElement, getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, processingInstruction, setDocumentLocator, setEscaping, setNamePool, setOutputProperties, setOutputStream, setSystemId, setUnparsedEntity, setWriter, startDocument, startElement, usesWriter

Field Details

emptyTags

(package private) static HashMap emptyTags
Table of HTML tags that have no closing tag

Constructor Details

HTMLEmitter

public HTMLEmitter()
Constructor

Method Details

characters

public void characters(char[] ch,
                       int start,
                       int length)
            throws TransformerException
Character data.
Overrides:
characters in interface XMLEmitter

endElement

public void endElement(int nameCode)
            throws TransformerException
Output an element end tag.
Overrides:
endElement in interface XMLEmitter
Parameters:

isEmptyTag

protected static boolean isEmptyTag(String tag)

isUrlAttribute

public static boolean isUrlAttribute(String element,
                                     String attribute)

processingInstruction

public void processingInstruction(String target,
                                  String data)
            throws TransformerException
Handle a processing instruction.
Overrides:
processingInstruction in interface XMLEmitter

startDocument

public void startDocument()
            throws TransformerException
Output start of document
Overrides:
startDocument in interface XMLEmitter

startElement

public void startElement(int nameCode,
                         Attributes atts,
                         int[] namespaces,
                         int nscount)
            throws TransformerException
Output element start tag
Overrides:
startElement in interface XMLEmitter

writeAttribute

protected void writeAttribute(int elCode,
                              String attname,
                              String type,
                              String value)
            throws TransformerException
Write attribute name=value pair. Overrides the XML behaviour if the name and value are the same (we assume this is a boolean attribute to be minimised), or if the value is a URL.
Overrides:
writeAttribute in interface XMLEmitter

writeEscape

protected void writeEscape(ch[] ,
                           int start,
                           int length,
                           boolean inAttribute)
            throws IOException
Escape characters. Overrides the XML behaviour
Overrides:
writeEscape in interface XMLEmitter