Package com.icl.saxon.output
Class Emitter
- java.lang.Object
-
- com.icl.saxon.output.Emitter
-
- All Implemented Interfaces:
Result
- Direct Known Subclasses:
Builder
,ContentHandlerProxy
,DocumentHandlerProxy
,DOMEmitter
,ErrorEmitter
,ProxyEmitter
,XMLEmitter
public abstract class Emitter extends Object implements Result
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
Fields Modifier and Type Field Description protected Locator
locator
protected NamePool
namePool
protected Properties
outputProperties
protected OutputStream
outputStream
protected String
systemId
protected Writer
writer
-
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
-
-
Constructor Summary
Constructors Constructor Description Emitter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
characters(char[] chars, int start, int len)
Output character dataabstract void
comment(char[] chars, int start, int length)
Output a comment.abstract void
endDocument()
Notify document endabstract void
endElement(int nameCode)
Output an element end tagNamePool
getNamePool()
Get the namepool used for this documentProperties
getOutputProperties()
Get the output propertiesOutputStream
getOutputStream()
Get the output streamString
getSystemId()
Get the System IDWriter
getWriter()
Get the output writerstatic Emitter
makeEmitter(String className)
load a named output emitter or document handler and check it is OK.abstract void
processingInstruction(String name, String data)
Output a processing instructionvoid
setDocumentLocator(Locator locator)
Set locator, to identify position in the document.void
setEscaping(boolean escaping)
Switch escaping on or off.void
setNamePool(NamePool namePool)
Set the namePool in which all name codes can be foundvoid
setOutputProperties(Properties props)
Set the output propertiesvoid
setOutputStream(OutputStream stream)
Set the output destination as a byte streamvoid
setSystemId(String systemId)
Set the System IDvoid
setUnparsedEntity(String name, String uri)
Set unparsed entity URI Used only when supplying input from a parser.void
setWriter(Writer writer)
Set the output destination as a character streamabstract void
startDocument()
Notify document startabstract void
startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount)
Output an element start tag.boolean
usesWriter()
Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output
-
-
-
Field Detail
-
namePool
protected NamePool namePool
-
systemId
protected String systemId
-
writer
protected Writer writer
-
outputStream
protected OutputStream outputStream
-
outputProperties
protected Properties outputProperties
-
locator
protected Locator locator
-
-
Method Detail
-
setNamePool
public void setNamePool(NamePool namePool)
Set the namePool in which all name codes can be found
-
getNamePool
public NamePool getNamePool()
Get the namepool used for this document
-
setSystemId
public void setSystemId(String systemId)
Set the System ID- Specified by:
setSystemId
in interfaceResult
-
getSystemId
public String getSystemId()
Get the System ID- Specified by:
getSystemId
in interfaceResult
-
setOutputProperties
public void setOutputProperties(Properties props)
Set the output properties
-
getOutputProperties
public 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
public void setWriter(Writer writer)
Set the output destination as a character stream
-
getWriter
public Writer getWriter()
Get the output writer
-
setOutputStream
public void setOutputStream(OutputStream stream)
Set the output destination as a byte stream
-
getOutputStream
public OutputStream getOutputStream()
Get the output stream
-
startDocument
public abstract void startDocument() throws TransformerException
Notify document start- Throws:
TransformerException
-
endDocument
public abstract void endDocument() throws TransformerException
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
public abstract void endElement(int nameCode) throws TransformerException
Output an element end tag- Throws:
TransformerException
-
characters
public abstract void characters(char[] chars, int start, int len) throws TransformerException
Output character data- Throws:
TransformerException
-
processingInstruction
public abstract void processingInstruction(String name, String data) throws TransformerException
Output a processing instruction- Throws:
TransformerException
-
comment
public abstract void comment(char[] chars, int start, int length) throws TransformerException
Output a comment.
(The method signature is borrowed from the SAX2 LexicalHandler interface)- Throws:
TransformerException
-
setEscaping
public void setEscaping(boolean escaping) throws TransformerException
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
public void setDocumentLocator(Locator locator)
Set locator, to identify position in the document. Used only when supplying input from a parser.
-
setUnparsedEntity
public void setUnparsedEntity(String name, String uri) throws TransformerException
Set unparsed entity URI Used only when supplying input from a parser.- Throws:
TransformerException
-
makeEmitter
public static Emitter makeEmitter(String className) throws TransformerException
load a named output emitter or document handler and check it is OK.- Throws:
TransformerException
-
-