com.icl.saxon.output

Class HTMLEmitter

public class HTMLEmitter extends XMLEmitter

This class generates HTML output

Author: Michael H. Kay

Field Summary
static HashMapemptyTags
Table of HTML tags that have no closing tag
Constructor Summary
HTMLEmitter()
Constructor
Method Summary
voidcharacters(char[] ch, int start, int length)
Character data.
voidendElement(int nameCode)
Output an element end tag.
protected static booleanisEmptyTag(String tag)
static booleanisUrlAttribute(String element, String attribute)
voidprocessingInstruction(String target, String data)
Handle a processing instruction.
voidstartDocument()
Output start of document
voidstartElement(int nameCode, Attributes atts, int[] namespaces, int nscount)
Output element start tag
protected voidwriteAttribute(int elCode, String attname, String type, String value)
Write attribute name=value pair.
protected voidwriteEscape(char[] ch, int start, int length, boolean inAttribute)
Escape characters.

Field Detail

emptyTags

static HashMap emptyTags
Table of HTML tags that have no closing tag

Constructor Detail

HTMLEmitter

public HTMLEmitter()
Constructor

Method Detail

characters

public void characters(char[] ch, int start, int length)
Character data.

endElement

public void endElement(int nameCode)
Output an element end tag.

Parameters: name The element name (tag)

isEmptyTag

protected static boolean isEmptyTag(String tag)

isUrlAttribute

public static boolean isUrlAttribute(String element, String attribute)

processingInstruction

public void processingInstruction(String target, String data)
Handle a processing instruction.

startDocument

public void startDocument()
Output start of document

startElement

public void startElement(int nameCode, Attributes atts, int[] namespaces, int nscount)
Output element start tag

writeAttribute

protected void writeAttribute(int elCode, String attname, String type, String value)
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.

writeEscape

protected void writeEscape(char[] ch, int start, int length, boolean inAttribute)
Escape characters. Overrides the XML behaviour