Package 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:
javax.xml.transform.Result,Receiver
public class HTMLEmitter extends XMLEmitter
This class generates HTML output- Author:
- Michael H. Kay
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static HTMLTagHashSetemptyTagsTable of HTML tags that have no closing tag-
Fields inherited from class net.sf.saxon.event.XMLEmitter
declarationIsWritten, elementCode, elementStack, empty, openStartTag, preferHex, specialInAtt, specialInText, undeclareNamespaces
-
Fields inherited from class net.sf.saxon.event.Emitter
allCharactersEncodable, characterSet, namePool, outputProperties, outputStream, pipelineConfig, streamResult, systemId, writer
-
-
Constructor Summary
Constructors Constructor Description HTMLEmitter()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(java.lang.CharSequence chars, int locationId, int properties)Character data.voidendElement()Output an element end tag.protected static booleanisEmptyTag(java.lang.String tag)voidopen()Output start of documentprotected voidopenDocument()Do the real work of starting the document.voidprocessingInstruction(java.lang.String target, java.lang.CharSequence data, int locationId, int properties)Handle a processing instruction.voidstartContent()Notify the start of the content, that is, the completion of all attributes and namespaces.voidstartElement(int nameCode, int typeCode, int locationId, int properties)Output element start tagprotected voidwriteAttribute(int elCode, java.lang.String attname, java.lang.CharSequence value, int properties)Write attribute name=value pair.protected voidwriteEscape(java.lang.CharSequence chars, boolean inAttribute)Escape characters.-
Methods inherited from class net.sf.saxon.event.XMLEmitter
attribute, close, closeStartTag, comment, emptyElementTagCloser, endDocument, main, namespace, outputCharacterReference, startDocument, testCharacters, writeCharSequence, writeDeclaration, writeDocType
-
Methods inherited from class net.sf.saxon.event.Emitter
getConfiguration, getOutputProperties, getOutputStream, getPipelineConfiguration, getSystemId, getWriter, makeWriter, setOutputProperties, setOutputStream, setPipelineConfiguration, setStreamResult, setSystemId, setUnparsedEntity, setWriter, usesWriter
-
-
-
-
Field Detail
-
emptyTags
static HTMLTagHashSet emptyTags
Table of HTML tags that have no closing tag
-
-
Method Detail
-
isEmptyTag
protected static boolean isEmptyTag(java.lang.String tag)
-
open
public void open() throws XPathExceptionOutput start of document- Specified by:
openin interfaceReceiver- Overrides:
openin classXMLEmitter- Throws:
XPathException
-
openDocument
protected void openDocument() throws XPathExceptionDescription copied from class:XMLEmitterDo the real work of starting the document. This happens when the first content is written.- Overrides:
openDocumentin classXMLEmitter- Throws:
XPathException
-
startElement
public void startElement(int nameCode, int typeCode, int locationId, int properties) throws XPathExceptionOutput element start tag- Specified by:
startElementin interfaceReceiver- Overrides:
startElementin classXMLEmitter- 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. The value -1 indicates the default type, xdt:untyped.locationId- an integer which can be interpreted using aLocationProviderto return information such as line number and system ID. If no location information is available, the value zero is supplied.properties- bit-significant properties of the element node. If there are no revelant properties, zero is supplied.- Throws:
XPathException
-
startContent
public void startContent() throws XPathExceptionDescription copied from interface:ReceiverNotify 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:
startContentin interfaceReceiver- Overrides:
startContentin classXMLEmitter- Throws:
XPathException
-
writeAttribute
protected void writeAttribute(int elCode, java.lang.String attname, java.lang.CharSequence value, int properties) throws XPathExceptionWrite 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:
writeAttributein classXMLEmitter- 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 encodingvalue- The value of the attributeproperties- Any special properties of the attribute- Throws:
XPathException
-
writeEscape
protected void writeEscape(java.lang.CharSequence chars, boolean inAttribute) throws java.io.IOException, XPathExceptionEscape characters. Overrides the XML behaviour- Overrides:
writeEscapein classXMLEmitter- Parameters:
chars- The character sequence containing the stringinAttribute- Set to true if the text is in an attribute value- Throws:
java.io.IOExceptionXPathException
-
endElement
public void endElement() throws XPathExceptionOutput an element end tag.- Specified by:
endElementin interfaceReceiver- Overrides:
endElementin classXMLEmitter- Throws:
XPathException
-
characters
public void characters(java.lang.CharSequence chars, int locationId, int properties) throws XPathExceptionCharacter data.- Specified by:
charactersin interfaceReceiver- Overrides:
charactersin classXMLEmitter- Parameters:
chars- The characterslocationId- an integer which can be interpreted using aLocationProviderto return information such as line number and system ID. If no location information is available, the value zero is supplied.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
- Throws:
XPathException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.CharSequence data, int locationId, int properties) throws XPathExceptionHandle a processing instruction.- Specified by:
processingInstructionin interfaceReceiver- Overrides:
processingInstructionin classXMLEmitter- Parameters:
target- The PI name. This must be a legal name (it will not be checked).data- The data portion of the processing instructionlocationId- an integer which can be interpreted using aLocationProviderto return information such as line number and system ID. If no location information is available, the value zero is supplied.properties- Additional information about the PI. The following bits are defined:- CHECKED
- Data is known to be legal (e.g. doesn't contain "?>")
- Throws:
XPathException
-
-