Class HTMLEmitter
java.lang.Object
net.sf.saxon.serialize.Emitter
net.sf.saxon.serialize.XMLEmitter
net.sf.saxon.serialize.HTMLEmitter
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static HTMLTagHashSetTable of HTML tags that have no closing tagFields inherited from class XMLEmitter
characterReferenceGenerator, declarationIsWritten, elementCode, elementStack, indentForNextAttribute, openStartTag, specialInAtt, specialInText, started, startedElement, undeclareNamespacesFields inherited from class Emitter
allCharactersEncodable, characterSet, namePool, outputProperties, outputStream, pipelineConfig, streamResult, systemId, writerFields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(CharSequence chars, int locationId, int properties) Character data.voidOutput an element end tag.protected static booleanisEmptyTag(String tag) voidopen()Output start of documentprotected voidDo the real work of starting the document.voidprocessingInstruction(String target, CharSequence data, int locationId, int properties) Handle a processing instruction.voidsetEscapeNonAscii(Boolean escape) Say that all non-ASCII characters should be escaped, regardless of the character encodingvoidNotify the start of the content, that is, the completion of all attributes and namespaces.voidstartElement(NodeName elemName, SchemaType typeCode, int locationId, int properties) Output element start tagprotected voidwriteAttribute(NodeName elCode, String attname, CharSequence value, int properties) Write attribute name=value pair.protected voidwriteDocType(String type, String systemId, String publicId) Output the document type declarationprotected voidwriteEscape(CharSequence chars, boolean inAttribute) Escape characters.Methods inherited from class XMLEmitter
attribute, close, closeStartTag, comment, emptyElementTagCloser, endDocument, getAttributeIndentString, namespace, setCharacterReferenceGenerator, setIndentForNextAttribute, startDocument, testCharacters, usesTypeAnnotations, writeCharSequence, writeDeclarationMethods inherited from class Emitter
getConfiguration, getOutputProperties, getOutputStream, getPipelineConfiguration, getSystemId, getWriter, makeOutputStream, makeWriter, setOutputProperties, setOutputStream, setPipelineConfiguration, setStreamResult, setSystemId, setUnparsedEntity, setWriter, usesWriter
-
Field Details
-
emptyTags
Table of HTML tags that have no closing tag
-
-
Constructor Details
-
HTMLEmitter
public HTMLEmitter()Constructor
-
-
Method Details
-
isEmptyTag
-
setEscapeNonAscii
Say that all non-ASCII characters should be escaped, regardless of the character encoding- Overrides:
setEscapeNonAsciiin classXMLEmitter- Parameters:
escape- true if all non ASCII characters should be escaped
-
open
Output start of document- Specified by:
openin interfaceReceiver- Overrides:
openin classXMLEmitter- Throws:
XPathException- if an error occurs
-
openDocument
Description copied from class:XMLEmitterDo the real work of starting the document. This happens when the first content is written.- Overrides:
openDocumentin classXMLEmitter- Throws:
XPathException- f an error occurs opening the output file
-
writeDocType
Output the document type declaration- Overrides:
writeDocTypein classXMLEmitter- Parameters:
type- The element namesystemId- The DOCTYP system identifierpublicId- The DOCTYPE public identifier- Throws:
XPathException- if an error occurs writing to the output
-
startElement
public void startElement(NodeName elemName, SchemaType typeCode, int locationId, int properties) throws XPathException Output element start tag- Specified by:
startElementin interfaceReceiver- Overrides:
startElementin classXMLEmitter- Parameters:
elemName- the name of the element.typeCode- the type annotation of the element.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. The definitions of the bits are in classReceiverOptions- Throws:
XPathException- if an error occurs
-
startContent
Description 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- if an error occurs
-
writeAttribute
protected void writeAttribute(NodeName elCode, String attname, CharSequence value, int properties) throws XPathException 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:
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- if an error occurs
-
writeEscape
protected void writeEscape(CharSequence chars, boolean inAttribute) throws IOException, XPathException Escape 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:
IOExceptionXPathException
-
endElement
Output an element end tag.- Specified by:
endElementin interfaceReceiver- Overrides:
endElementin classXMLEmitter- Throws:
XPathException- if an error occurs
-
characters
Character 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
- Throws:
XPathException- if an error occurs
-
processingInstruction
public void processingInstruction(String target, CharSequence data, int locationId, int properties) throws XPathException Handle 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.- Throws:
XPathException- if an error occurs
-