public abstract class HTMLEmitter extends XMLEmitter
| Modifier and Type | Field and Description |
|---|---|
protected int |
version |
attSpecials, canonical, characterReferenceGenerator, declarationIsWritten, delimiter, DOCTYPE, elementCode, elementStack, indentForNextAttribute, internalSubset, openStartTag, RIGHT_ANGLE_NEWLINE, specialInAtt, specialInAttSingle, specialInText, started, startedElement, undeclareNamespaces, unfailingallCharactersEncodable, characterSet, outputProperties, writerpipelineConfiguration, previousAtomic, systemId| Constructor and Description |
|---|
HTMLEmitter()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(UnicodeString chars,
Location locationId,
int properties)
Character data.
|
void |
endElement()
Output an element end tag.
|
protected static boolean |
isEmptyTag(java.lang.String tag) |
protected abstract boolean |
isHTMLElement(NodeName name)
Decide whether an element is "serialized as an HTML element" in the language of the 3.0 specification
|
void |
open()
Output start of document
|
protected void |
openDocument()
Do the real work of starting the document.
|
void |
processingInstruction(java.lang.String target,
UnicodeString data,
Location locationId,
int properties)
Handle a processing instruction.
|
protected abstract boolean |
rejectControlCharacters()
Ask whether control characters should be rejected: true for HTML4, false for HTML5
|
protected static void |
setEmptyTag(java.lang.String tag) |
void |
setEscapeNonAscii(java.lang.Boolean escape)
Say that all non-ASCII characters should be escaped, regardless of the character encoding
|
void |
startContentOLD() |
void |
startElement(NodeName elemName,
SchemaType type,
AttributeMap attributes,
NamespaceMap namespaces,
Location location,
int properties)
Output element start tag
|
protected void |
writeAttribute(NodeName elCode,
java.lang.String attname,
java.lang.String value,
int properties)
Write attribute name=value pair.
|
protected void |
writeDocType(NodeName name,
java.lang.String displayName,
java.lang.String systemId,
java.lang.String publicId)
Output the document type declaration
|
protected void |
writeEmptyElementTagCloser(java.lang.String displayName,
NodeName nameCode)
Close an empty element tag.
|
protected void |
writeEscape(UnicodeString chars,
boolean inAttribute)
Escape characters.
|
close, closeStartTag, comment, convertToAscii, endDocument, isStarted, namespace, setCharacterReferenceGenerator, setIndentForNextAttribute, startDocument, testCharacters, usesTypeAnnotations, writeAttributeIndentString, writeCodePoint, writeDeclaration, writeDocTypeWithNullSystemIdappend, getOutputProperties, setMustClose, setOutputProperties, setUnicodeWriter, setUnparsedEntityappend, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getNamePool, getPipelineConfiguration, getSystemId, handlesAppend, setPipelineConfiguration, setSystemIdclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappend, getPipelineConfiguration, handlesAppend, setPipelineConfigurationprotected static void setEmptyTag(java.lang.String tag)
protected static boolean isEmptyTag(java.lang.String tag)
public void setEscapeNonAscii(java.lang.Boolean escape)
setEscapeNonAscii in class XMLEmitterescape - true if all non ASCII characters should be escapedprotected abstract boolean isHTMLElement(NodeName name)
name - the name of the elementpublic void open()
throws XPathException
open in interface Receiveropen in class XMLEmitterXPathException - if an error occursprotected void openDocument()
throws XPathException
XMLEmitteropenDocument in class XMLEmitterXPathException - if an error occurs opening the output fileprotected void writeDocType(NodeName name, java.lang.String displayName, java.lang.String systemId, java.lang.String publicId) throws XPathException
writeDocType in class XMLEmitterdisplayName - The element namesystemId - The DOCTYPE system identifierpublicId - The DOCTYPE public identifiername - the qualified name of the elementXPathException - if an error occurs writing to the outputpublic void startElement(NodeName elemName, SchemaType type, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties) throws XPathException
startElement in interface ReceiverstartElement in class XMLEmitterelemName - the name of the elementtype - the type annotation of the elementattributes - the attributes of this elementnamespaces - the in-scope namespaces of this element: generally this is all the in-scope
namespaces, without relying on inheriting namespaces from parent elementslocation - an object providing information about the module, line, and column where the node originatedproperties - bit-significant properties of the element node. If there are no relevant
properties, zero is supplied. The definitions of the bits are in class ReceiverOptionXPathException - if an error occurspublic void startContentOLD()
throws XPathException
XPathExceptionprotected void writeAttribute(NodeName elCode, java.lang.String attname, java.lang.String value, int properties) throws XPathException
writeAttribute in class XMLEmitterelCode - 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 attributeXPathException - if an error occursprotected void writeEscape(UnicodeString chars, boolean inAttribute) throws java.io.IOException, XPathException
writeEscape in class XMLEmitterchars - The character sequence containing the stringinAttribute - Set to true if the text is in an attribute valuejava.io.IOException - if an IO exception occursXPathException - if an IO exception occursprotected abstract boolean rejectControlCharacters()
protected void writeEmptyElementTagCloser(java.lang.String displayName,
NodeName nameCode)
throws java.io.IOException
writeEmptyElementTagCloser in class XMLEmitterdisplayName - the name of the empty elementnameCode - the fingerprint of the name of the empty elementjava.io.IOException - if an IO exception occurspublic void endElement()
throws XPathException
endElement in interface ReceiverendElement in class XMLEmitterXPathException - if an error occurspublic void characters(UnicodeString chars, Location locationId, int properties) throws XPathException
characters in interface Receivercharacters in class XMLEmitterchars - The characterslocationId - provides information such as line number and system ID.properties - Bit significant value. The following bits are defined:
XPathException - if an error occurspublic void processingInstruction(java.lang.String target,
UnicodeString data,
Location locationId,
int properties)
throws XPathException
processingInstruction in interface ReceiverprocessingInstruction in class XMLEmittertarget - The PI name. This must be a legal name (it will not be checked).data - The data portion of the processing instructionlocationId - provides information such as line number and system ID.properties - Additional information about the PI.XPathException - if an error occursCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.