XMLEmitter is an Emitter that generates XML output
to a specified destination.
declarationIsWritten
protected boolean declarationIsWritten
elementCode
protected int elementCode
elementStack
protected Stack elementStack
empty
protected boolean empty
openStartTag
protected boolean openStartTag
preferHex
protected boolean preferHex
undeclareNamespaces
protected boolean undeclareNamespaces
attribute
public void attribute(int nameCode,
int typeCode,
CharSequence value,
int locationId,
int properties)
throws XPathException
- attribute in interface Receiver
closeStartTag
public void closeStartTag()
throws XPathException
Mark the end of the start tag
comment
public void comment(CharSequence chars,
int locationId,
int properties)
throws XPathException
Handle a comment.
- comment in interface Receiver
emptyElementTagCloser
protected String emptyElementTagCloser(String displayName,
int nameCode)
Close an empty element tag. (This is overridden in XHTMLEmitter).
displayName
- the name of the empty elementnameCode
- the fingerprint of the name of the empty element
- the string used to close an empty element tag.
open
public void open()
throws XPathException
Start of the event stream. Nothing is done at this stage: the opening of the output
file is deferred until some content is written to it.
- open in interface Receiver
openDocument
protected void openDocument()
throws XPathException
Do the real work of starting the document. This happens when the first
content is written.
outputCharacterReference
protected void outputCharacterReference(int charval)
throws java.io.IOException
processingInstruction
public void processingInstruction(String target,
CharSequence data,
int locationId,
int properties)
throws XPathException
Handle a processing instruction.
- processingInstruction in interface Receiver
startDocument
public void startDocument(int properties)
throws XPathException
Start of a document node. Nothing is done at this stage: the opening of the output
file is deferred until some content is written to it.
- startDocument in interface Receiver
startElement
public void startElement(int nameCode,
int typeCode,
int locationId,
int properties)
throws XPathException
Start of an element. Output the start tag, escaping special characters.
- startElement in interface Receiver
testCharacters
protected int testCharacters(CharSequence chars)
throws XPathException
Test that all characters in a name (for example) are supported in the target encoding.
chars
- the characters to be tested
- zero if all the characters are available, or the value of the
first offending character if not
writeAttribute
protected void writeAttribute(int elCode,
String attname,
CharSequence value,
int properties)
throws XPathException
Write attribute name=value pair.
elCode
- The element name is not used in this version of the
method, but is used in the HTML subclass.attname
- The attribute name, which has already been validated to ensure
it can be written in this encodingvalue
- The value of the attributeproperties
- Any special properties of the attribute
writeCharSequence
public void writeCharSequence(CharSequence s)
throws java.io.IOException
Write a CharSequence (without any escaping of special characters): various implementations
s
- the character sequence to be written
writeDeclaration
public void writeDeclaration()
throws XPathException
Output the XML declaration
writeDocType
protected void writeDocType(String type,
String systemId,
String publicId)
throws XPathException
Output the document type declaration
type
- The element namesystemId
- The DOCTYP system identifierpublicId
- The DOCTYPE public identifier
writeEscape
protected void writeEscape(CharSequence chars,
boolean inAttribute)
throws java.io.IOException,
XPathException
Write contents of array to current writer, after escaping special characters.
This method converts the XML special characters (such as <32and &) into their
predefined entities.
chars
- The character sequence containing the stringinAttribute
- Set to true if the text is in an attribute value