net.sf.saxon.event
Class HTMLEmitter

java.lang.Object
  |
  +--net.sf.saxon.event.Emitter
        |
        +--net.sf.saxon.event.XMLEmitter
              |
              +--net.sf.saxon.event.HTMLEmitter
All Implemented Interfaces:
Receiver, javax.xml.transform.Result

public class HTMLEmitter
extends XMLEmitter

This class generates HTML output


Field Summary
 
Fields inherited from class net.sf.saxon.event.XMLEmitter
declarationIsWritten, elementCode, elementStack, empty, escaping, openStartTag, preferHex, undeclareNamespaces
 
Fields inherited from class net.sf.saxon.event.Emitter
characterSet, locator, namePool, outputProperties, outputStream, streamResult, systemId, writer
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
HTMLEmitter()
          Constructor
 
Method Summary
 void characters(java.lang.CharSequence chars, int properties)
          Character data.
 void endElement()
          Output an element end tag.
protected static boolean isEmptyTag(java.lang.String tag)
           
static boolean isUrlAttribute(java.lang.String element, java.lang.String attribute)
           
protected  void openDocument()
          Do the real work of starting the document.
 void processingInstruction(java.lang.String target, java.lang.CharSequence data, int properties)
          Handle a processing instruction.
 void startContent()
          Notify the start of the content, that is, the completion of all attributes and namespaces.
 void startDocument()
          Output start of document
 void startElement(int nameCode, int typeCode, int properties)
          Output element start tag
protected  void writeAttribute(int elCode, java.lang.String attname, java.lang.CharSequence value, int properties)
          Write attribute name=value pair.
protected  void writeEscape(java.lang.CharSequence chars, boolean inAttribute)
          Escape characters.
 
Methods inherited from class net.sf.saxon.event.XMLEmitter
attribute, closeStartTag, comment, emptyElementTagCloser, endDocument, namespace, outputCharacterReference, setDocumentLocator, setUnparsedEntity, testCharacters, writeDeclaration, writeDocType
 
Methods inherited from class net.sf.saxon.event.Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, makeWriter, setNamePool, setOutputProperties, setOutputStream, setStreamResult, setSystemId, setUnparsedEntity, setWriter, usesWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLEmitter

public HTMLEmitter()
Constructor

Method Detail

isEmptyTag

protected static boolean isEmptyTag(java.lang.String tag)

isUrlAttribute

public static boolean isUrlAttribute(java.lang.String element,
                                     java.lang.String attribute)

startDocument

public void startDocument()
                   throws javax.xml.transform.TransformerException
Output start of document

Specified by:
startDocument in interface Receiver
Overrides:
startDocument in class XMLEmitter
javax.xml.transform.TransformerException

openDocument

protected void openDocument()
                     throws javax.xml.transform.TransformerException
Description copied from class: XMLEmitter
Do the real work of starting the document. This happens when the first content is written.

Overrides:
openDocument in class XMLEmitter
Throws:
javax.xml.transform.TransformerException

startElement

public void startElement(int nameCode,
                         int typeCode,
                         int properties)
                  throws javax.xml.transform.TransformerException
Output element start tag

Specified by:
startElement in interface Receiver
Overrides:
startElement in class XMLEmitter
Parameters:
nameCode - integer code identifying the name of the element within the name pool.
typeCode - integer code identifying the element's type within the name pool.
javax.xml.transform.TransformerException

startContent

public void startContent()
                  throws javax.xml.transform.TransformerException
Description copied from interface: Receiver
Notify the start of the content, that is, the completion of all attributes and namespaces. Note that the initial receiver of output from XSLT instructions will not receive this event, it has to detect it itself. Note that this event is reported for every element even if it has no attributes, no namespaces, and no content.

Specified by:
startContent in interface Receiver
Overrides:
startContent in class XMLEmitter
javax.xml.transform.TransformerException

writeAttribute

protected void writeAttribute(int elCode,
                              java.lang.String attname,
                              java.lang.CharSequence value,
                              int properties)
                       throws javax.xml.transform.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 class XMLEmitter
Parameters:
elCode - The element name is not used in this version of the method, but is used in the HTML subclass.
attname - The attribute name, which has already been validated to ensure it can be written in this encoding
value - The value of the attribute
properties - Any special properties of the attribute
javax.xml.transform.TransformerException

writeEscape

protected void writeEscape(java.lang.CharSequence chars,
                           boolean inAttribute)
                    throws java.io.IOException
Escape characters. Overrides the XML behaviour

Overrides:
writeEscape in class XMLEmitter
Parameters:
chars - The character sequence containing the string
inAttribute - Set to true if the text is in an attribute value
java.io.IOException

endElement

public void endElement()
                throws javax.xml.transform.TransformerException
Output an element end tag.

Specified by:
endElement in interface Receiver
Overrides:
endElement in class XMLEmitter
javax.xml.transform.TransformerException

characters

public void characters(java.lang.CharSequence chars,
                       int properties)
                throws javax.xml.transform.TransformerException
Character data.

Specified by:
characters in interface Receiver
Overrides:
characters in class XMLEmitter
Parameters:
chars - The characters
properties - Bit significant value. The following bits are defined:
DISABLE_ESCAPING
Disable escaping for this text node
USE_CDATA
Output as a CDATA section
NO_SPECIAL_CHARACTERS
Value contains no special characters
WHITESPACE
Text is all whitespace
javax.xml.transform.TransformerException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.CharSequence data,
                                  int properties)
                           throws javax.xml.transform.TransformerException
Handle a processing instruction.

Specified by:
processingInstruction in interface Receiver
Overrides:
processingInstruction in class XMLEmitter
Parameters:
target - The PI name. This must be a legal name (it will not be checked).
data - The data portion of the processing instruction
properties - Additional information about the PI. The following bits are defined:
CHECKED
Data is known to be legal (e.g. doesn't contain "?>")
javax.xml.transform.TransformerException