com.icl.saxon.output
Class StringOutputter
public final class StringOutputter
This class allows output to be generated. It channels output requests to an
Emitter which does the actual writing. This is a specialized and simplified version
that is used to handle xsl:attribute, xsl:comment, and xsl:processing-instruction.
checkAttributePrefix, close, copyNamespaceNode, getEmitter, getOutputProperties, open, reset, setEscaping, thereIsAnOpenStartTag, write, writeAttribute, writeAttribute, writeComment, writeContent, writeContent, writeEndTag, writeNamespaceDeclaration, writePI, writeStartTag |
StringOutputter
public StringOutputter(StringBuffer buffer)
checkAttributePrefix
public int checkAttributePrefix(int nameCode)
throws TransformerException Check that the prefix for an attribute is acceptable, returning a substitute
prefix if not. The prefix is acceptable unless a namespace declaration has been
written that assignes this prefix to a different namespace URI. This method
also checks that the attribute namespace has been declared, and declares it
if not.
- checkAttributePrefix in interface Outputter
close
public void close()
throws TransformerException Close the output
- close in interface Outputter
copyNamespaceNode
public void copyNamespaceNode(int nscode)
throws TransformerException Copy a namespace node to the current element node
(Rules defined in XSLT 1.0 errata)
- copyNamespaceNode in interface Outputter
getOutputProperties
public Properties getOutputProperties()
- getOutputProperties in interface Outputter
reset
public void reset()
throws TransformerException- reset in interface Outputter
setErrorListener
public void setErrorListener(ErrorListener listener)
thereIsAnOpenStartTag
public boolean thereIsAnOpenStartTag()
Test whether there is an open start tag. This determines whether it is
possible to write an attribute node at this point.
- thereIsAnOpenStartTag in interface Outputter
write
public void write(String s)
throws TransformerException Produce literal output. This is written as is, without any escaping.
The method is provided for Java applications that wish to output literal HTML text.
It is not used by the XSL system, which always writes using specific methods such as
writeStartTag().
- write in interface Outputter
writeAttribute
public void writeAttribute(int nameCode,
String value,
boolean noEscape)
throws TransformerException Output an attribute value.
No-op in this implementation.
- writeAttribute in interface Outputter
value - The value of the attributenoEscape - True if it's known there are no special characters in the value. If
unsure, set this to false.
writeComment
public void writeComment(String comment)
throws TransformerException Write a comment.
No-op in this implementation
- writeComment in interface Outputter
writeContent
public void writeContent(String s)
throws TransformerException Produce text content output.
Special characters are escaped using XML/HTML conventions if the output format
requires it.
- writeContent in interface Outputter
s - The String to be output
writeContent
public void writeContent(char[] chars,
int start,
int length)
throws TransformerException Produce text content output.
Special characters are escaped using XML/HTML conventions if the output format
requires it.
- writeContent in interface Outputter
chars - Character array to be outputstart - start position of characters to be outputlength - number of characters to be output
writeEndTag
public void writeEndTag(int nameCode)
throws TransformerException Output an element end tag.
- writeEndTag in interface Outputter
nameCode - The element name code
writeNamespaceDeclaration
public void writeNamespaceDeclaration(int nscode)
throws TransformerException Output a namespace declaration.
This is added to a list of pending namespaces for the current start tag.
If there is already another declaration of the same prefix, this one is
ignored.
Note that unlike SAX2 startPrefixMapping(), this call is made AFTER writing the start tag.
- writeNamespaceDeclaration in interface Outputter
nscode - The namespace code
writePI
public void writePI(String target,
String data)
throws TransformerException Write a processing instruction
No-op in this implementation
- writePI in interface Outputter
writeStartTag
public void writeStartTag(int nameCode)
throws TransformerException Output an element start tag. With this outputter, this is a recoverable error.
- writeStartTag in interface Outputter
nameCode - The element name code