Class Emitter
java.lang.Object
com.icl.saxon.output.Emitter
- All Implemented Interfaces:
Result
- Direct Known Subclasses:
Builder, ContentHandlerProxy, DocumentHandlerProxy, DOMEmitter, ErrorEmitter, ProxyEmitter, StringEmitter, XMLEmitter
Emitter: This interface defines methods that must be implemented by
components that format SAXON output. There is one emitter for XML,
one for HTML, and so on. Additional methods are concerned with
setting options and providing a Writer.
The interface is deliberately designed to be as close as possible to the standard SAX2 ContentHandler interface, however, it allows additional information to be made available.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Locatorprotected NamePoolprotected Propertiesprotected OutputStreamprotected Stringprotected WriterFields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcharacters(char[] chars, int start, int len) Output character dataabstract voidcomment(char[] chars, int start, int length) Output a comment.abstract voidNotify document endabstract voidendElement(int nameCode) Output an element end tagGet the namepool used for this documentGet the output propertiesGet the output streamGet the System IDGet the output writerstatic EmittermakeEmitter(String className) load a named output emitter or document handler and check it is OK.abstract voidprocessingInstruction(String name, String data) Output a processing instructionvoidsetDocumentLocator(Locator locator) Set locator, to identify position in the document.voidsetEscaping(boolean escaping) Switch escaping on or off.voidsetNamePool(NamePool namePool) Set the namePool in which all name codes can be foundvoidsetOutputProperties(Properties props) Set the output propertiesvoidsetOutputStream(OutputStream stream) Set the output destination as a byte streamvoidsetSystemId(String systemId) Set the System IDvoidsetUnparsedEntity(String name, String uri) Set unparsed entity URI Used only when supplying input from a parser.voidSet the output destination as a character streamabstract voidNotify document startabstract voidstartElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) Output an element start tag.booleanDetermine whether the Emitter wants a Writer for character output or an OutputStream for binary output
-
Field Details
-
namePool
-
systemId
-
writer
-
outputStream
-
outputProperties
-
locator
-
-
Constructor Details
-
Emitter
public Emitter()
-
-
Method Details
-
setNamePool
Set the namePool in which all name codes can be found -
getNamePool
Get the namepool used for this document -
setSystemId
Set the System ID- Specified by:
setSystemIdin interfaceResult
-
getSystemId
-
setOutputProperties
Set the output properties -
getOutputProperties
Get the output properties -
usesWriter
public boolean usesWriter()Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output -
setWriter
Set the output destination as a character stream -
getWriter
Get the output writer -
setOutputStream
Set the output destination as a byte stream -
getOutputStream
Get the output stream -
startDocument
Notify document start- Throws:
TransformerException
-
endDocument
Notify document end- Throws:
TransformerException
-
startElement
public abstract void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) throws TransformerException Output an element start tag.- 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
-
endElement
Output an element end tag- Throws:
TransformerException
-
characters
Output character data- Throws:
TransformerException
-
processingInstruction
Output a processing instruction- Throws:
TransformerException
-
comment
Output a comment.
(The method signature is borrowed from the SAX2 LexicalHandler interface)- Throws:
TransformerException
-
setEscaping
Switch escaping on or off. This is called when the XSLT disable-output-escaping attribute is used to switch escaping on or off. It is also called at the start and end of a CDATA section It is not called for other sections of output (e.g. comments) where escaping is inappropriate.- Throws:
TransformerException
-
setDocumentLocator
Set locator, to identify position in the document. Used only when supplying input from a parser. -
setUnparsedEntity
Set unparsed entity URI Used only when supplying input from a parser.- Throws:
TransformerException
-
makeEmitter
load a named output emitter or document handler and check it is OK.- Throws:
TransformerException
-