public class XMLEmitter extends Emitter
| Modifier and Type | Field and Description |
|---|---|
protected CharacterSet |
characterSet |
protected boolean |
declarationIsWritten |
protected boolean |
empty |
protected boolean |
escaping |
protected String |
lastDisplayName |
protected int |
lastNameCode |
protected String |
lastPrefix |
protected String |
lastURI |
protected boolean |
openStartTag |
protected boolean |
preferHex |
locator, namePool, outputProperties, outputStream, systemId, writerPI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING| Constructor and Description |
|---|
XMLEmitter() |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Character data.
|
protected void |
closeStartTag(int nameCode,
boolean emptyTag) |
void |
comment(char[] ch,
int start,
int length)
Handle a comment.
|
protected String |
emptyElementTagCloser(int nameCode)
Close an empty element tag.
|
void |
endDocument()
End of the document.
|
void |
endElement(int nameCode)
End of an element.
|
protected void |
outputCharacterReference(int charval) |
void |
processingInstruction(String target,
String data)
Handle a processing instruction.
|
void |
setDocumentLocator(Locator locator)
Set Document Locator.
|
void |
setEscaping(boolean escaping)
Set escaping on or off
|
void |
setOutputProperties(Properties details)
Set output properties
|
void |
setResult(Result result)
Set the result destination
|
void |
setUnparsedEntity(String name,
String uri)
Set the URI for an unparsed entity in the document.
|
void |
startDocument()
Start of the document.
|
void |
startElement(int nameCode,
Attributes attributes,
int[] namespaces,
int nscount)
Start of an element.
|
protected boolean |
testCharacters(char[] array,
int start,
int len) |
protected void |
testCharacters(String name)
Test that all characters in a name are supported in the target encoding
|
protected void |
writeAttribute(int elCode,
String attname,
String type,
String value) |
void |
writeDeclaration()
Output the XML declaration
|
protected void |
writeDocType(String type,
String systemId,
String publicId) |
protected void |
writeEscape(char[] ch,
int start,
int length,
boolean inAttribute)
Write contents of array to current writer, after escaping special characters
|
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setNamePool, setOutputStream, setSystemId, setWriter, usesWriterprotected CharacterSet characterSet
protected boolean empty
protected boolean escaping
protected boolean openStartTag
protected boolean declarationIsWritten
protected boolean preferHex
protected int lastNameCode
protected String lastDisplayName
protected String lastPrefix
protected String lastURI
public void setDocumentLocator(Locator locator)
setDocumentLocator in class Emitterpublic void startDocument()
throws TransformerException
startDocument in class EmitterTransformerExceptionpublic void writeDeclaration()
throws TransformerException
TransformerExceptionprotected void writeDocType(String type, String systemId, String publicId) throws TransformerException
TransformerExceptionpublic void endDocument()
throws TransformerException
endDocument in class EmitterTransformerExceptionpublic void startElement(int nameCode,
Attributes attributes,
int[] namespaces,
int nscount)
throws TransformerException
startElement in class Emitternamespaces - Array of namespace codes identifying the namespace prefix/uri
pairs associated with this elementnscount - Number of significant entries within namespaces arrayTransformerExceptionprotected void closeStartTag(int nameCode,
boolean emptyTag)
throws TransformerException
TransformerExceptionprotected String emptyElementTagCloser(int nameCode)
protected void writeAttribute(int elCode,
String attname,
String type,
String value)
throws TransformerException
TransformerExceptionprotected void testCharacters(String name) throws TransformerException
TransformerExceptionprotected boolean testCharacters(char[] array,
int start,
int len)
public void endElement(int nameCode)
throws TransformerException
endElement in class EmitterTransformerExceptionpublic void characters(char[] ch,
int start,
int length)
throws TransformerException
characters in class EmitterTransformerExceptionpublic void processingInstruction(String target, String data) throws TransformerException
processingInstruction in class EmitterTransformerExceptionprotected void writeEscape(char[] ch,
int start,
int length,
boolean inAttribute)
throws IOException
ch - The character array containing the stringstart - The start position of the input string within the character arraylength - The length of the input string within the character array
This method converts the XML special characters (such as < and &) into their
predefined entities.IOExceptionprotected void outputCharacterReference(int charval)
throws IOException
IOExceptionpublic void setEscaping(boolean escaping)
setEscaping in class Emitterpublic void comment(char[] ch,
int start,
int length)
throws TransformerException
comment in class EmitterTransformerExceptionpublic void setResult(Result result)
public void setOutputProperties(Properties details)
setOutputProperties in class Emitterpublic void setUnparsedEntity(String name, String uri) throws TransformerException
setUnparsedEntity in class EmitterTransformerException