Package com.icl.saxon.output
Class Emitter
- java.lang.Object
-
- com.icl.saxon.output.Emitter
-
- All Implemented Interfaces:
javax.xml.transform.Result
- Direct Known Subclasses:
Builder,ContentHandlerProxy,DocumentHandlerProxy,DOMEmitter,ErrorEmitter,ProxyEmitter,StringEmitter,XMLEmitter
public abstract class Emitter extends java.lang.Object implements javax.xml.transform.ResultEmitter: 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 org.xml.sax.Locatorlocatorprotected NamePoolnamePoolprotected java.util.PropertiesoutputPropertiesprotected java.io.OutputStreamoutputStreamprotected java.lang.StringsystemIdprotected java.io.Writerwriter
-
Constructor Summary
Constructors Constructor Description Emitter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcharacters(char[] chars, int start, int len)Output character dataabstract voidcomment(char[] chars, int start, int length)Output a comment.abstract voidendDocument()Notify document endabstract voidendElement(int nameCode)Output an element end tagNamePoolgetNamePool()Get the namepool used for this documentjava.util.PropertiesgetOutputProperties()Get the output propertiesjava.io.OutputStreamgetOutputStream()Get the output streamjava.lang.StringgetSystemId()Get the System IDjava.io.WritergetWriter()Get the output writerstatic EmittermakeEmitter(java.lang.String className)load a named output emitter or document handler and check it is OK.abstract voidprocessingInstruction(java.lang.String name, java.lang.String data)Output a processing instructionvoidsetDocumentLocator(org.xml.sax.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(java.util.Properties props)Set the output propertiesvoidsetOutputStream(java.io.OutputStream stream)Set the output destination as a byte streamvoidsetSystemId(java.lang.String systemId)Set the System IDvoidsetUnparsedEntity(java.lang.String name, java.lang.String uri)Set unparsed entity URI Used only when supplying input from a parser.voidsetWriter(java.io.Writer writer)Set the output destination as a character streamabstract voidstartDocument()Notify document startabstract voidstartElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)Output an element start tag.booleanusesWriter()Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output
-
-
-
Field Detail
-
namePool
protected NamePool namePool
-
systemId
protected java.lang.String systemId
-
writer
protected java.io.Writer writer
-
outputStream
protected java.io.OutputStream outputStream
-
outputProperties
protected java.util.Properties outputProperties
-
locator
protected org.xml.sax.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(java.lang.String systemId)
Set the System ID- Specified by:
setSystemIdin interfacejavax.xml.transform.Result
-
getSystemId
public java.lang.String getSystemId()
Get the System ID- Specified by:
getSystemIdin interfacejavax.xml.transform.Result
-
setOutputProperties
public void setOutputProperties(java.util.Properties props)
Set the output properties
-
getOutputProperties
public java.util.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(java.io.Writer writer)
Set the output destination as a character stream
-
getWriter
public java.io.Writer getWriter()
Get the output writer
-
setOutputStream
public void setOutputStream(java.io.OutputStream stream)
Set the output destination as a byte stream
-
getOutputStream
public java.io.OutputStream getOutputStream()
Get the output stream
-
startDocument
public abstract void startDocument() throws javax.xml.transform.TransformerExceptionNotify document start- Throws:
javax.xml.transform.TransformerException
-
endDocument
public abstract void endDocument() throws javax.xml.transform.TransformerExceptionNotify document end- Throws:
javax.xml.transform.TransformerException
-
startElement
public abstract void startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount) throws javax.xml.transform.TransformerExceptionOutput 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:
javax.xml.transform.TransformerException
-
endElement
public abstract void endElement(int nameCode) throws javax.xml.transform.TransformerExceptionOutput an element end tag- Throws:
javax.xml.transform.TransformerException
-
characters
public abstract void characters(char[] chars, int start, int len) throws javax.xml.transform.TransformerExceptionOutput character data- Throws:
javax.xml.transform.TransformerException
-
processingInstruction
public abstract void processingInstruction(java.lang.String name, java.lang.String data) throws javax.xml.transform.TransformerExceptionOutput a processing instruction- Throws:
javax.xml.transform.TransformerException
-
comment
public abstract void comment(char[] chars, int start, int length) throws javax.xml.transform.TransformerExceptionOutput a comment.
(The method signature is borrowed from the SAX2 LexicalHandler interface)- Throws:
javax.xml.transform.TransformerException
-
setEscaping
public void setEscaping(boolean escaping) throws javax.xml.transform.TransformerExceptionSwitch 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:
javax.xml.transform.TransformerException
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
Set locator, to identify position in the document. Used only when supplying input from a parser.
-
setUnparsedEntity
public void setUnparsedEntity(java.lang.String name, java.lang.String uri) throws javax.xml.transform.TransformerExceptionSet unparsed entity URI Used only when supplying input from a parser.- Throws:
javax.xml.transform.TransformerException
-
makeEmitter
public static Emitter makeEmitter(java.lang.String className) throws javax.xml.transform.TransformerException
load a named output emitter or document handler and check it is OK.- Throws:
javax.xml.transform.TransformerException
-
-