Package com.icl.saxon.output
Class HTMLEmitter
java.lang.Object
com.icl.saxon.output.Emitter
com.icl.saxon.output.XMLEmitter
com.icl.saxon.output.HTMLEmitter
- All Implemented Interfaces:
Result
This class generates HTML output
- Author:
- Michael H. Kay
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static HashMap
Table of HTML tags that have no closing tagFields 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
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Output start of documentvoid
startElement
(int nameCode, Attributes atts, int[] namespaces, int nscount) Output element start tagprotected void
writeAttribute
(int elCode, String attname, String type, String value) Write attribute name=value pair.protected void
writeEscape
(char[] ch, int start, int length, boolean inAttribute) Escape characters.Methods inherited from class com.icl.saxon.output.XMLEmitter
closeStartTag, comment, emptyElementTagCloser, endDocument, outputCharacterReference, setDocumentLocator, setEscaping, setOutputProperties, setResult, setUnparsedEntity, testCharacters, testCharacters, writeDeclaration, writeDocType
Methods inherited from class com.icl.saxon.output.Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setNamePool, setOutputStream, setSystemId, setWriter, usesWriter
-
Field Details
-
emptyTags
Table of HTML tags that have no closing tag
-
-
Constructor Details
-
HTMLEmitter
public HTMLEmitter()Constructor
-
-
Method Details
-
isEmptyTag
-
isUrlAttribute
-
startDocument
Output start of document- Overrides:
startDocument
in classXMLEmitter
- Throws:
TransformerException
-
startElement
public void startElement(int nameCode, Attributes atts, int[] namespaces, int nscount) throws TransformerException Output element start tag- Overrides:
startElement
in classXMLEmitter
- Parameters:
namespaces
- Array of namespace codes identifying the namespace prefix/uri pairs associated with this elementnscount
- Number of significant entries within namespaces array- Throws:
TransformerException
-
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 classXMLEmitter
- Throws:
TransformerException
-
writeEscape
protected void writeEscape(char[] ch, int start, int length, boolean inAttribute) throws IOException Escape characters. Overrides the XML behaviour- Overrides:
writeEscape
in classXMLEmitter
- Parameters:
ch
- The character array containing the stringstart
- The start position of the input string within the character arraylength
- The length of the input string within the character array This method converts the XML special characters (such as invalid input: '<' and invalid input: '&') into their predefined entities.- Throws:
IOException
-
endElement
Output an element end tag.- Overrides:
endElement
in classXMLEmitter
- Parameters:
name
- The element name (tag)- Throws:
TransformerException
-
characters
Character data.- Overrides:
characters
in classXMLEmitter
- Throws:
TransformerException
-
processingInstruction
Handle a processing instruction.- Overrides:
processingInstruction
in classXMLEmitter
- Throws:
TransformerException
-