com.icl.saxon.output

Class XMLEmitter

public class XMLEmitter extends Emitter

XMLEmitter is an Emitter that generates XML output to a specified destination.
Field Summary
char[]attbuff1
Write attribute name=value pair.
protected CharacterSetcharacterSet
protected booleandeclarationIsWritten
booleandocTypeWritten
Output the document type declaration
protected booleanempty
protected booleanescaping
protected StringlastDisplayName
protected intlastNameCode
protected StringlastPrefix
protected StringlastURI
protected booleanopenStartTag
protected booleanpreferHex
static boolean[]specialInAtt
static boolean[]specialInText
Method Summary
voidcharacters(char[] ch, int start, int length)
Character data.
protected voidcloseStartTag(int nameCode, boolean emptyTag)
voidcomment(char[] ch, int start, int length)
Handle a comment.
protected StringemptyElementTagCloser(int nameCode)
Close an empty element tag.
voidendDocument()
End of the document.
voidendElement(int nameCode)
End of an element.
protected voidoutputCharacterReference(int charval)
voidprocessingInstruction(String target, String data)
Handle a processing instruction.
voidsetDocumentLocator(Locator locator)
Set Document Locator.
voidsetEscaping(boolean escaping)
Set escaping on or off
voidsetOutputProperties(Properties details)
Set output properties
voidsetResult(Result result)
Set the result destination
voidsetUnparsedEntity(String name, String uri)
Set the URI for an unparsed entity in the document.
voidstartDocument()
Start of the document.
voidstartElement(int nameCode, Attributes attributes, int[] namespaces, int nscount)
Start of an element.
protected voidtestCharacters(String name)
Test that all characters in a name are supported in the target encoding
protected booleantestCharacters(char[] array, int start, int len)
protected voidwriteAttribute(int elCode, String attname, String type, String value)
voidwriteDeclaration()
Output the XML declaration
protected voidwriteDocType(String type, String systemId, String publicId)
protected voidwriteEscape(char[] ch, int start, int length, boolean inAttribute)
Write contents of array to current writer, after escaping special characters

Field Detail

attbuff1

char[] attbuff1
Write attribute name=value pair. The element name is not used in this version of the method, but is used in the HTML subclass.

characterSet

protected CharacterSet characterSet

declarationIsWritten

protected boolean declarationIsWritten

docTypeWritten

boolean docTypeWritten
Output the document type declaration

empty

protected boolean empty

escaping

protected boolean escaping

lastDisplayName

protected String lastDisplayName

lastNameCode

protected int lastNameCode

lastPrefix

protected String lastPrefix

lastURI

protected String lastURI

openStartTag

protected boolean openStartTag

preferHex

protected boolean preferHex

specialInAtt

static boolean[] specialInAtt

specialInText

static boolean[] specialInText

Method Detail

characters

public void characters(char[] ch, int start, int length)
Character data.

closeStartTag

protected void closeStartTag(int nameCode, boolean emptyTag)

comment

public void comment(char[] ch, int start, int length)
Handle a comment.

emptyElementTagCloser

protected String emptyElementTagCloser(int nameCode)
Close an empty element tag. (This is overridden in XHTMLEmitter).

endDocument

public void endDocument()
End of the document. Close the output stream.

endElement

public void endElement(int nameCode)
End of an element.

outputCharacterReference

protected void outputCharacterReference(int charval)

processingInstruction

public void processingInstruction(String target, String data)
Handle a processing instruction.

setDocumentLocator

public void setDocumentLocator(Locator locator)
Set Document Locator. Provided merely to satisfy the interface.

setEscaping

public void setEscaping(boolean escaping)
Set escaping on or off

setOutputProperties

public void setOutputProperties(Properties details)
Set output properties

setResult

public void setResult(Result result)
Set the result destination

setUnparsedEntity

public void setUnparsedEntity(String name, String uri)
Set the URI for an unparsed entity in the document.

startDocument

public void startDocument()
Start of the document. Make the writer and write the XML declaration.

startElement

public void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount)
Start of an element. Output the start tag, escaping special characters.

testCharacters

protected void testCharacters(String name)
Test that all characters in a name are supported in the target encoding

testCharacters

protected boolean testCharacters(char[] array, int start, int len)

writeAttribute

protected void writeAttribute(int elCode, String attname, String type, String value)

writeDeclaration

public void writeDeclaration()
Output the XML declaration

writeDocType

protected void writeDocType(String type, String systemId, String publicId)

writeEscape

protected void writeEscape(char[] ch, int start, int length, boolean inAttribute)
Write contents of array to current writer, after escaping special characters

Parameters: ch The character array containing the string start The start position of the input string within the character array length The length of the input string within the character array This method converts the XML special characters (such as < and &) into their predefined entities.