Class XMLEmitter
java.lang.Object
com.icl.saxon.output.Emitter
com.icl.saxon.output.XMLEmitter
- All Implemented Interfaces:
Result
- Direct Known Subclasses:
HTMLEmitter, MessageEmitter, TEXTEmitter, XHTMLEmitter
XMLEmitter is an Emitter that generates XML output
to a specified destination.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) char[]Write attribute name=value pair.protected CharacterSetprotected boolean(package private) booleanOutput the document type declarationprotected booleanprotected booleanprotected Stringprotected intprotected Stringprotected Stringprotected booleanprotected boolean(package private) static boolean[](package private) static boolean[]Fields inherited from class Emitter
locator, namePool, outputProperties, outputStream, systemId, writerFields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(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.voidEnd 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 offvoidsetOutputProperties(Properties details) Set output propertiesvoidSet the result destinationvoidsetUnparsedEntity(String name, String uri) Set the URI for an unparsed entity in the document.voidStart of the document.voidstartElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) Start of an element.protected booleantestCharacters(char[] array, int start, int len) protected voidtestCharacters(String name) Test that all characters in a name are supported in the target encodingprotected voidwriteAttribute(int elCode, String attname, String type, String value) voidOutput the XML declarationprotected 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 charactersMethods inherited from class Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setNamePool, setOutputStream, setSystemId, setWriter, usesWriter
-
Field Details
-
characterSet
-
empty
protected boolean empty -
escaping
protected boolean escaping -
openStartTag
protected boolean openStartTag -
declarationIsWritten
protected boolean declarationIsWritten -
preferHex
protected boolean preferHex -
lastNameCode
protected int lastNameCode -
lastDisplayName
-
lastPrefix
-
lastURI
-
specialInText
static boolean[] specialInText -
specialInAtt
static boolean[] specialInAtt -
docTypeWritten
boolean docTypeWrittenOutput the document type declaration -
attbuff1
char[] attbuff1Write attribute name=value pair. The element name is not used in this version of the method, but is used in the HTML subclass.
-
-
Constructor Details
-
XMLEmitter
public XMLEmitter()
-
-
Method Details
-
setDocumentLocator
Set Document Locator. Provided merely to satisfy the interface.- Overrides:
setDocumentLocatorin classEmitter
-
startDocument
Start of the document. Make the writer and write the XML declaration.- Specified by:
startDocumentin classEmitter- Throws:
TransformerException
-
writeDeclaration
Output the XML declaration- Throws:
TransformerException
-
writeDocType
protected void writeDocType(String type, String systemId, String publicId) throws TransformerException - Throws:
TransformerException
-
endDocument
End of the document. Close the output stream.- Specified by:
endDocumentin classEmitter- Throws:
TransformerException
-
startElement
public void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) throws TransformerException Start of an element. Output the start tag, escaping special characters.- Specified by:
startElementin classEmitter- Parameters:
namespaces- Array of namespace codes identifying the namespace prefix/uri pairs associated with this elementnscount- Number of significant entries within namespaces array- Throws:
TransformerException
-
closeStartTag
- Throws:
TransformerException
-
emptyElementTagCloser
Close an empty element tag. (This is overridden in XHTMLEmitter). -
writeAttribute
protected void writeAttribute(int elCode, String attname, String type, String value) throws TransformerException - Throws:
TransformerException
-
testCharacters
Test that all characters in a name are supported in the target encoding- Throws:
TransformerException
-
testCharacters
protected boolean testCharacters(char[] array, int start, int len) -
endElement
End of an element.- Specified by:
endElementin classEmitter- Throws:
TransformerException
-
characters
Character data.- Specified by:
charactersin classEmitter- Throws:
TransformerException
-
processingInstruction
Handle a processing instruction.- Specified by:
processingInstructionin classEmitter- Throws:
TransformerException
-
writeEscape
protected void writeEscape(char[] ch, int start, int length, boolean inAttribute) throws IOException Write contents of array to current writer, after escaping special characters- Parameters:
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 invalid input: '<' and invalid input: '&') into their predefined entities.- Throws:
IOException
-
outputCharacterReference
- Throws:
IOException
-
setEscaping
public void setEscaping(boolean escaping) Set escaping on or off- Overrides:
setEscapingin classEmitter
-
comment
Handle a comment.- Specified by:
commentin classEmitter- Throws:
TransformerException
-
setResult
Set the result destination -
setOutputProperties
Set output properties- Overrides:
setOutputPropertiesin classEmitter
-
setUnparsedEntity
Set the URI for an unparsed entity in the document.- Overrides:
setUnparsedEntityin classEmitter- Throws:
TransformerException
-