com.icl.saxon.output

Class Emitter

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
protected Locatorlocator
protected NamePoolnamePool
protected PropertiesoutputProperties
protected OutputStreamoutputStream
protected StringsystemId
protected Writerwriter
Method Summary
abstract voidcharacters(char[] chars, int start, int len)
Output character data
abstract voidcomment(char[] chars, int start, int length)
Output a comment.
abstract voidendDocument()
Notify document end
abstract voidendElement(int nameCode)
Output an element end tag
NamePoolgetNamePool()
Get the namepool used for this document
PropertiesgetOutputProperties()
Get the output properties
OutputStreamgetOutputStream()
Get the output stream
StringgetSystemId()
Get the System ID
WritergetWriter()
Get the output writer
static 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 instruction
voidsetDocumentLocator(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 found
voidsetOutputProperties(Properties props)
Set the output properties
voidsetOutputStream(OutputStream stream)
Set the output destination as a byte stream
voidsetSystemId(String systemId)
Set the System ID
voidsetUnparsedEntity(String name, String uri)
Set unparsed entity URI Used only when supplying input from a parser.
voidsetWriter(Writer writer)
Set the output destination as a character stream
abstract voidstartDocument()
Notify document start
abstract voidstartElement(int nameCode, 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

locator

protected Locator locator

namePool

protected NamePool namePool

outputProperties

protected Properties outputProperties

outputStream

protected OutputStream outputStream

systemId

protected String systemId

writer

protected Writer writer

Method Detail

characters

public abstract void characters(char[] chars, int start, int len)
Output character data

comment

public abstract void comment(char[] chars, int start, int length)
Output a comment.
(The method signature is borrowed from the SAX2 LexicalHandler interface)

endDocument

public abstract void endDocument()
Notify document end

endElement

public abstract void endElement(int nameCode)
Output an element end tag

UNKNOWN: name code The name code identifying the element. Use the namePool.getDisplayName() method to obtain the tag to display in XML output.

getNamePool

public NamePool getNamePool()
Get the namepool used for this document

getOutputProperties

public Properties getOutputProperties()
Get the output properties

getOutputStream

public OutputStream getOutputStream()
Get the output stream

getSystemId

public String getSystemId()
Get the System ID

getWriter

public Writer getWriter()
Get the output writer

makeEmitter

public static Emitter makeEmitter(String className)
load a named output emitter or document handler and check it is OK.

processingInstruction

public abstract void processingInstruction(String name, String data)
Output a processing instruction

setDocumentLocator

public void setDocumentLocator(Locator locator)
Set locator, to identify position in the document. Used only when supplying input from a parser.

setEscaping

public void setEscaping(boolean escaping)
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.

setNamePool

public void setNamePool(NamePool namePool)
Set the namePool in which all name codes can be found

setOutputProperties

public void setOutputProperties(Properties props)
Set the output properties

setOutputStream

public void setOutputStream(OutputStream stream)
Set the output destination as a byte stream

setSystemId

public void setSystemId(String systemId)
Set the System ID

setUnparsedEntity

public void setUnparsedEntity(String name, String uri)
Set unparsed entity URI Used only when supplying input from a parser.

setWriter

public void setWriter(Writer writer)
Set the output destination as a character stream

startDocument

public abstract void startDocument()
Notify document start

startElement

public abstract void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount)
Output an element start tag.

Parameters: namespaces Array of namespace codes identifying the namespace prefix/uri pairs associated with this element nscount Number of significant entries within namespaces array

UNKNOWN: name The Name Code identifying the name of the Element within the name pool. attributes The attributes (excluding namespace declarations) associated with this element.

usesWriter

public boolean usesWriter()
Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output