| java.lang.Object org.apache.xml.serializer.SerializerBase org.apache.xml.serializer.ToStream
All known Subclasses: org.apache.xml.serializer.ToTextStream, org.apache.xml.serializer.ToHTMLStream, org.apache.xml.serializer.ToXMLStream,
ToStream | abstract public class ToStream extends SerializerBase (Code) | | This abstract class is a base class for other stream
serializers (xml, html, text ...) that write output to a stream.
|
Inner Class :final static class BoolStack | |
Field Summary | |
protected boolean | m_cdataStartCalled | protected CharInfo | m_charInfo Map that tells which characters should have special treatment, and it
provides character to entity name lookup. | protected BoolStack | m_disableOutputEscapingStates Stack to keep track of disabling output escaping. | EncodingInfo | m_encodingInfo The encoding information associated with this serializer.
Although initially there is no encoding,
there is a dummy EncodingInfo object that will say
that every character is in the encoding. | protected Properties | m_format The xsl:output properties. | protected boolean | m_inDoctype Tells if we're in an internal document type subset. | boolean | m_isUTF8 Flag to quickly tell if the encoding is UTF8. | protected boolean | m_ispreserve State flag to tell if preservation of whitespace
is important. | protected boolean | m_isprevtext State flag that tells if the previous node processed
was text, so we can tell if we should preserve whitespace.
Used in endDocument() and shouldIndent() but
only if m_doIndent is true. | protected char[] | m_lineSep The system line separator for writing out line breaks. | protected int | m_lineSepLen The length of the line seperator, since the write is done
one character at a time. | protected boolean | m_lineSepUse True if the the system line separator is to be used. | protected BoolStack | m_preserves Stack to keep track of whether or not we need to
preserve whitespace. | boolean | m_shouldFlush True if we control the buffer, and we should flush the output on endDocument. | protected boolean | m_spaceBeforeClose Add space before '/>' for XHTML. | boolean | m_startNewLine Flag to signal that a newline should be added. |
Method Summary | |
protected int | accumDefaultEntity(java.io.Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) Handle one of the default entities, return false if it
is not a default entity.
Parameters: ch - character to be escaped. Parameters: i - index into character array. Parameters: chars - non-null reference to character array. Parameters: len - length of chars. Parameters: fromTextNode - true if the characters being processedare from a text node, false if they are from an attribute value Parameters: escLF - true if the linefeed should be escaped. | protected int | accumDefaultEscape(Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) Escape and writer.write a character.
Parameters: ch - character to be escaped. Parameters: i - index into character array. Parameters: chars - non-null reference to character array. Parameters: len - length of chars. Parameters: fromTextNode - true if the characters being processed arefrom a text node, false if the characters being processed are froman attribute value. Parameters: escLF - true if the linefeed should be escaped. | public boolean | addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean xslAttribute) Adds the given attribute to the set of attributes, even if there is
no currently open element. | public void | attributeDecl(String eName, String aName, String type, String valueDefault, String value) Report an attribute type declaration.
Only the effective (first) declaration for an attribute will
be reported. | protected void | cdata(char ch, int start, int length) Receive notification of cdata.
The Parser will call this method to report each chunk of
character data. | public void | characters(char chars, int start, int length) Receive notification of character data.
The Parser will call this method to report each chunk of
character data. | public void | characters(String s) Receive notification of character data. | protected void | charactersRaw(char ch, int start, int length) If available, when the disable-output-escaping attribute is used,
output raw text without escaping. | protected void | closeCDATA() This helper method to writes out "]]>" when closing a CDATA section. | protected void | closeStartTag() | public void | comment(char ch, int start, int length) Receive notification of an XML comment anywhere in the document. | public void | elementDecl(String name, String model) Report an element type declaration.
The content model will consist of the string "EMPTY", the
string "ANY", or a parenthesised group, optionally followed
by an occurrence indicator. | public void | endCDATA() Report the end of a CDATA section. | public void | endDTD() Report the end of DTD declarations. | public void | endElement(String namespaceURI, String localName, String name) Receive notification of the end of an element. | public void | endElement(String name) Receive notification of the end of an element. | public void | endNonEscaping() Ends an un-escaping section. | public void | endPrefixMapping(String prefix) End the scope of a prefix-URI Namespace mapping. | protected String | ensureAttributesNamespaceIsDeclared(String ns, String localName, String rawName) Makes sure that the namespace URI for the given qualified attribute name
is declared.
Parameters: ns - the namespace URI Parameters: rawName - the qualified name returns null if no action is taken, otherwise it returns theprefix used in declaring the namespace. | void | ensurePrefixIsDeclared(String ns, String rawName) | protected boolean | escapingNotNeeded(char ch) Tell if this character can be written without escaping. | public void | externalEntityDecl(String name, String publicId, String systemId) Report a parsed external entity declaration.
Only the effective (first) declaration for each entity
will be reported.
Parameters: name - The name of the entity. | protected void | firePseudoAttributes() To fire off the pseudo characters of attributes, as they currently
exist. | public void | flushPending() This method flushes any pending events, which can be startDocument()
closing the opening tag of an element, or closing an open CDATA section. | final protected void | flushWriter() Flush the formatter's result stream. | public int | getIndentAmount() Returns the m_indentAmount. | public Properties | getOutputFormat() Returns the output format for this serializer. | public OutputStream | getOutputStream() Get the output stream where the events will be serialized to. | public Writer | getWriter() Get the character stream where the events will be serialized to. | public void | ignorableWhitespace(char ch, int start, int length) Receive notification of ignorable whitespace in element content. | protected void | indent(int depth) Might print a newline character and the indentation amount
of the given depth. | protected void | indent() Indent at the current element nesting depth. | protected synchronized void | init(OutputStream output, Properties format, boolean defaultProperties) Initialize the serializer with the specified output stream and output
format. | public void | internalEntityDecl(String name, String value) Report an internal entity declaration.
Only the effective (first) declaration for each entity
will be reported.
Parameters: name - The name of the entity. | public void | notationDecl(String name, String pubID, String sysID) If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities. | void | outputDocTypeDecl(String name, boolean closeDecl) Output the doc type declaration. | void | outputEntityDecl(String name, String value) Output the doc type declaration. | final protected void | outputLineSep() Output a system-dependent line break. | public void | processAttributes(java.io.Writer writer, int nAttrs) Process the attributes, which means to write out the currently
collected attributes to the writer. | public boolean | reset() Try's to reset the super class and reset this class for
re-use, so that you don't need to create a new serializer
(mostly for performance reasons). | public void | serialize(Node node) Serializes the DOM node. | public void | setCdataSectionElements(Vector URI_and_localNames) Remembers the cdata sections specified in the cdata-section-elements.
The "official way to set URI and localName pairs. | public void | setContentHandler(ContentHandler ch) | public void | setDTDEntityExpansion(boolean expand) | public void | setEncoding(String encoding) Sets the character encoding coming from the xsl:output encoding stylesheet attribute. | public boolean | setEscaping(boolean escape) | public void | setIndentAmount(int m_indentAmount) Sets the m_indentAmount. | public boolean | setLineSepUse(boolean use_sytem_line_break) Set if the operating systems end-of-line line separator should
be used when serializing. | public void | setOutputFormat(Properties format) Specifies an output format for this serializer. | public void | setOutputStream(OutputStream output) Specifies an output stream to which the document should be
serialized. | public void | setTransformer(Transformer transformer) | public void | setWriter(Writer writer) Specifies a writer to which the document should be serialized. | protected boolean | shouldIndent() Tell if, based on space preservation constraints and the doIndent property,
if an indent should occur. | public void | skippedEntity(String name) Receive notification of a skipped entity.
See Also: org.xml.sax.ContentHandler.skippedEntity Parameters: name - The name of the skipped entity. | public void | startCDATA() Report the start of a CDATA section. | public void | startDTD(String name, String publicId, String systemId) Report the start of DTD declarations, if any. | public void | startElement(String namespaceURI, String localName, String name, Attributes atts) Receive notification of the beginning of an element, although this is a
SAX method additional namespace or attribute information can occur before
or after this call, that is associated with this element. | public void | startElement(String elementNamespaceURI, String elementLocalName, String elementName) Receive notification of the beginning of an element, additional
namespace or attribute information can occur before or after this call,
that is associated with this element. | public void | startElement(String elementName) | public void | startEntity(String name) Report the beginning of an entity.
The start and end of the document entity are not reported.
The start and end of the external DTD subset are reported
using the pseudo-name "[dtd]". | public void | startNonEscaping() Starts an un-escaping section. | public void | startPrefixMapping(String prefix, String uri) Begin the scope of a prefix-URI Namespace mapping
just before another element is about to start. | public boolean | startPrefixMapping(String prefix, String uri, boolean shouldFlush) Handle a prefix/uri mapping, which is associated with a startElement()
that is soon to follow. | public void | unparsedEntityDecl(String name, String pubID, String sysID, String notationName) If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities. | public void | writeAttrString(Writer writer, String string, String encoding) Returns the specified string after substituting specials,
and UTF-16 surrogates for chracter references &#xnn . | void | writeNormalizedChars(char ch, int start, int length, boolean isCData, boolean useSystemLineSeparator) Normalize the characters, but don't escape. | protected int | writeUTF16Surrogate(char c, char ch, int i, int end) Once a surrogate has been detected, write out the pair of
characters if it is in the encoding, or if there is no
encoding, otherwise write out an entity reference
of the value of the unicode code point of the character
represented by the high/low surrogate pair.
An exception is thrown if there is no low surrogate in the pair,
because the array ends unexpectely, or if the low char is there
but its value is such that it is not a low surrogate.
Parameters: c - the first (high) part of the surrogate, whichmust be confirmed before calling this method. Parameters: ch - Character array. Parameters: i - position Where the surrogate was detected. Parameters: end - The end index of the significant characters. |
m_cdataStartCalled | protected boolean m_cdataStartCalled(Code) | | remembers if we are in between the startCDATA() and endCDATA() callbacks
|
m_charInfo | protected CharInfo m_charInfo(Code) | | Map that tells which characters should have special treatment, and it
provides character to entity name lookup.
|
m_disableOutputEscapingStates | protected BoolStack m_disableOutputEscapingStates(Code) | | Stack to keep track of disabling output escaping.
|
m_encodingInfo | EncodingInfo m_encodingInfo(Code) | | The encoding information associated with this serializer.
Although initially there is no encoding,
there is a dummy EncodingInfo object that will say
that every character is in the encoding. This is useful
for a serializer that is in temporary output state and has
no associated encoding. A serializer in final output state
will have an encoding, and will worry about whether
single chars or surrogate pairs of high/low chars form
characters in the output encoding.
|
m_inDoctype | protected boolean m_inDoctype(Code) | | Tells if we're in an internal document type subset.
|
m_isUTF8 | boolean m_isUTF8(Code) | | Flag to quickly tell if the encoding is UTF8.
|
m_ispreserve | protected boolean m_ispreserve(Code) | | State flag to tell if preservation of whitespace
is important.
Used only in shouldIndent() but only if m_doIndent is true.
If m_doIndent is false this flag has no impact.
|
m_isprevtext | protected boolean m_isprevtext(Code) | | State flag that tells if the previous node processed
was text, so we can tell if we should preserve whitespace.
Used in endDocument() and shouldIndent() but
only if m_doIndent is true.
If m_doIndent is false this flag has no impact.
|
m_lineSep | protected char[] m_lineSep(Code) | | The system line separator for writing out line breaks.
The default value is from the system property,
but this value can be set through the xsl:output
extension attribute xalan:line-separator.
|
m_lineSepLen | protected int m_lineSepLen(Code) | | The length of the line seperator, since the write is done
one character at a time.
|
m_lineSepUse | protected boolean m_lineSepUse(Code) | | True if the the system line separator is to be used.
|
m_preserves | protected BoolStack m_preserves(Code) | | Stack to keep track of whether or not we need to
preserve whitespace.
Used to push/pop values used for the field m_ispreserve, but
m_ispreserve is only relevant if m_doIndent is true.
If m_doIndent is false this field has no impact.
|
m_shouldFlush | boolean m_shouldFlush(Code) | | True if we control the buffer, and we should flush the output on endDocument.
|
m_spaceBeforeClose | protected boolean m_spaceBeforeClose(Code) | | Add space before '/>' for XHTML.
|
m_startNewLine | boolean m_startNewLine(Code) | | Flag to signal that a newline should be added.
Used only in indent() which is called only if m_doIndent is true.
If m_doIndent is false this flag has no impact.
|
ToStream | public ToStream()(Code) | | Default constructor
|
accumDefaultEntity | protected int accumDefaultEntity(java.io.Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException(Code) | | Handle one of the default entities, return false if it
is not a default entity.
Parameters: ch - character to be escaped. Parameters: i - index into character array. Parameters: chars - non-null reference to character array. Parameters: len - length of chars. Parameters: fromTextNode - true if the characters being processedare from a text node, false if they are from an attribute value Parameters: escLF - true if the linefeed should be escaped. i+1 if the character was written, else i. throws: java.io.IOException - |
accumDefaultEscape | protected int accumDefaultEscape(Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException(Code) | | Escape and writer.write a character.
Parameters: ch - character to be escaped. Parameters: i - index into character array. Parameters: chars - non-null reference to character array. Parameters: len - length of chars. Parameters: fromTextNode - true if the characters being processed arefrom a text node, false if the characters being processed are froman attribute value. Parameters: escLF - true if the linefeed should be escaped. i+1 if a character was written, i+2 if two characterswere written out, else return i. throws: org.xml.sax.SAXException - |
addAttributeAlways | public boolean addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean xslAttribute)(Code) | | Adds the given attribute to the set of attributes, even if there is
no currently open element. This is useful if a SAX startPrefixMapping()
should need to add an attribute before the element name is seen.
This method is a copy of its super classes method, except that some
tracing of events is done. This is so the tracing is only done for
stream serializers, not for SAX ones.
Parameters: uri - the URI of the attribute Parameters: localName - the local name of the attribute Parameters: rawName - the qualified name of the attribute Parameters: type - the type of the attribute (probably CDATA) Parameters: value - the value of the attribute Parameters: xslAttribute - true if this attribute is coming from an xsl:attribute element. true if the attribute value was added, false if the attribute already existed and the value wasreplaced with the new value. |
attributeDecl | public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException(Code) | | Report an attribute type declaration.
Only the effective (first) declaration for an attribute will
be reported. The type will be one of the strings "CDATA",
"ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
"ENTITIES", or "NOTATION", or a parenthesized token group with
the separator "|" and all whitespace removed.
Parameters: eName - The name of the associated element. Parameters: aName - The name of the attribute. Parameters: type - A string representing the attribute type. Parameters: valueDefault - A string representing the attribute default("#IMPLIED", "#REQUIRED", or "#FIXED") or null ifnone of these applies. Parameters: value - A string representing the attribute's default value,or null if there is none. exception: SAXException - The application may raise an exception. |
cdata | protected void cdata(char ch, int start, int length) throws org.xml.sax.SAXException(Code) | | Receive notification of cdata.
The Parser will call this method to report each chunk of
character data. SAX parsers may return all contiguous character
data in a single chunk, or they may split it into several
chunks; however, all of the characters in any single event
must come from the same external entity, so that the Locator
provides useful information.
The application must not attempt to read from the array
outside of the specified range.
Note that some parsers will report whitespace using the
ignorableWhitespace() method rather than this one (validating
parsers must do so).
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception. See Also: ToStream.ignorableWhitespace See Also: org.xml.sax.Locator throws: org.xml.sax.SAXException - |
characters | public void characters(char chars, int start, int length) throws org.xml.sax.SAXException(Code) | | Receive notification of character data.
The Parser will call this method to report each chunk of
character data. SAX parsers may return all contiguous character
data in a single chunk, or they may split it into several
chunks; however, all of the characters in any single event
must come from the same external entity, so that the Locator
provides useful information.
The application must not attempt to read from the array
outside of the specified range.
Note that some parsers will report whitespace using the
ignorableWhitespace() method rather than this one (validating
parsers must do so).
Parameters: chars - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception. See Also: ToStream.ignorableWhitespace See Also: org.xml.sax.Locator throws: org.xml.sax.SAXException - |
charactersRaw | protected void charactersRaw(char ch, int start, int length) throws org.xml.sax.SAXException(Code) | | If available, when the disable-output-escaping attribute is used,
output raw text without escaping.
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: org.xml.sax.SAXException - |
comment | public void comment(char ch, int start, int length) throws org.xml.sax.SAXException(Code) | | Receive notification of an XML comment anywhere in the document. This
callback will be used for comments inside or outside the document
element, including comments in the external DTD subset (if read).
Parameters: ch - An array holding the characters in the comment. Parameters: start - The starting position in the array. Parameters: length - The number of characters to use from the array. throws: org.xml.sax.SAXException - The application may raise an exception. |
elementDecl | public void elementDecl(String name, String model) throws SAXException(Code) | | Report an element type declaration.
The content model will consist of the string "EMPTY", the
string "ANY", or a parenthesised group, optionally followed
by an occurrence indicator. The model will be normalized so
that all whitespace is removed,and will include the enclosing
parentheses.
Parameters: name - The element type name. Parameters: model - The content model as a normalized string. exception: SAXException - The application may raise an exception. |
endElement | public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException(Code) | | Receive notification of the end of an element.
Parameters: namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed. Parameters: localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed. Parameters: name - The element type name throws: org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception. throws: org.xml.sax.SAXException - |
ensureAttributesNamespaceIsDeclared | protected String ensureAttributesNamespaceIsDeclared(String ns, String localName, String rawName) throws org.xml.sax.SAXException(Code) | | Makes sure that the namespace URI for the given qualified attribute name
is declared.
Parameters: ns - the namespace URI Parameters: rawName - the qualified name returns null if no action is taken, otherwise it returns theprefix used in declaring the namespace. throws: SAXException - |
escapingNotNeeded | protected boolean escapingNotNeeded(char ch)(Code) | | Tell if this character can be written without escaping.
|
externalEntityDecl | public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException(Code) | | Report a parsed external entity declaration.
Only the effective (first) declaration for each entity
will be reported.
Parameters: name - The name of the entity. If it is a parameterentity, the name will begin with '%'. Parameters: publicId - The declared public identifier of the entity, ornull if none was declared. Parameters: systemId - The declared system identifier of the entity. exception: SAXException - The application may raise an exception. See Also: ToStream.internalEntityDecl See Also: org.xml.sax.DTDHandler.unparsedEntityDecl |
firePseudoAttributes | protected void firePseudoAttributes()(Code) | | To fire off the pseudo characters of attributes, as they currently
exist. This method should be called everytime an attribute is added,
or when an attribute value is changed, or an element is created.
|
flushPending | public void flushPending() throws SAXException(Code) | | This method flushes any pending events, which can be startDocument()
closing the opening tag of an element, or closing an open CDATA section.
|
getIndentAmount | public int getIndentAmount()(Code) | | Returns the m_indentAmount.
int |
getOutputFormat | public Properties getOutputFormat()(Code) | | Returns the output format for this serializer.
The output format in use |
getOutputStream | public OutputStream getOutputStream()(Code) | | Get the output stream where the events will be serialized to.
reference to the result stream, or null of only a writer wasset. |
getWriter | public Writer getWriter()(Code) | | Get the character stream where the events will be serialized to.
Reference to the result Writer, or null. |
ignorableWhitespace | public void ignorableWhitespace(char ch, int start, int length) throws org.xml.sax.SAXException(Code) | | Receive notification of ignorable whitespace in element content.
Not sure how to get this invoked quite yet.
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception. See Also: ToStream.characters throws: org.xml.sax.SAXException - |
indent | protected void indent(int depth) throws IOException(Code) | | Might print a newline character and the indentation amount
of the given depth.
Parameters: depth - the indentation depth (element nesting depth) throws: org.xml.sax.SAXException - if an error occurs during writing. |
init | protected synchronized void init(OutputStream output, Properties format, boolean defaultProperties) throws UnsupportedEncodingException(Code) | | Initialize the serializer with the specified output stream and output
format. Must be called before calling any of the serialize methods.
Parameters: output - The output stream to use Parameters: format - The output format Parameters: defaultProperties - true if the properties are the defaultproperties throws: UnsupportedEncodingException - The encoding specified in theoutput format is not supported |
outputDocTypeDecl | void outputDocTypeDecl(String name, boolean closeDecl) throws SAXException(Code) | | Output the doc type declaration.
Parameters: name - non-null reference to document type name.NEEDSDOC @param closeDecl throws: java.io.IOException - |
processAttributes | public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException(Code) | | Process the attributes, which means to write out the currently
collected attributes to the writer. The attributes are not
cleared by this method
Parameters: writer - the writer to write processed attributes to. Parameters: nAttrs - the number of attributes in m_attributes to be processed throws: java.io.IOException - throws: org.xml.sax.SAXException - |
reset | public boolean reset()(Code) | | Try's to reset the super class and reset this class for
re-use, so that you don't need to create a new serializer
(mostly for performance reasons).
true if the class was successfuly reset. |
serialize | public void serialize(Node node) throws IOException(Code) | | Serializes the DOM node. Throws an exception only if an I/O
exception occured while serializing.
Parameters: node - Node to serialize. throws: IOException - An I/O exception occured while serializing |
setCdataSectionElements | public void setCdataSectionElements(Vector URI_and_localNames)(Code) | | Remembers the cdata sections specified in the cdata-section-elements.
The "official way to set URI and localName pairs.
This method should be used by both Xalan and XSLTC.
Parameters: URI_and_localNames - a vector of pairs of Strings (URI/local) |
setDTDEntityExpansion | public void setDTDEntityExpansion(boolean expand)(Code) | | If set to false the serializer does not expand DTD entities,
but leaves them as is, the default value is true;
|
setEncoding | public void setEncoding(String encoding)(Code) | | Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
Parameters: encoding - the character encoding |
setIndentAmount | public void setIndentAmount(int m_indentAmount)(Code) | | Sets the m_indentAmount.
Parameters: m_indentAmount - The m_indentAmount to set |
setLineSepUse | public boolean setLineSepUse(boolean use_sytem_line_break)(Code) | | Set if the operating systems end-of-line line separator should
be used when serializing. If set false NL character
(decimal 10) is left alone, otherwise the new-line will be replaced on
output with the systems line separator. For example on UNIX this is
NL, while on Windows it is two characters, CR NL, where CR is the
carriage-return (decimal 13).
Parameters: use_sytem_line_break - True if an input NL is replaced with the operating systems end-of-line separator. The previously set value of the serializer. |
setOutputFormat | public void setOutputFormat(Properties format)(Code) | | Specifies an output format for this serializer. It the
serializer has already been associated with an output format,
it will switch to the new format. This method should not be
called while the serializer is in the process of serializing
a document.
Parameters: format - The output format to use |
setOutputStream | public void setOutputStream(OutputStream output)(Code) | | Specifies an output stream to which the document should be
serialized. This method should not be called while the
serializer is in the process of serializing a document.
The encoding specified in the output properties is used, or
if no encoding was specified, the default for the selected
output method.
Parameters: output - The output stream |
setWriter | public void setWriter(Writer writer)(Code) | | Specifies a writer to which the document should be serialized.
This method should not be called while the serializer is in
the process of serializing a document.
Parameters: writer - The output writer stream |
shouldIndent | protected boolean shouldIndent()(Code) | | Tell if, based on space preservation constraints and the doIndent property,
if an indent should occur.
True if an indent should occur. |
startDTD | public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException(Code) | | Report the start of DTD declarations, if any.
Any declarations are assumed to be in the internal subset unless
otherwise indicated.
Parameters: name - The document type name. Parameters: publicId - The declared public identifier for theexternal DTD subset, or null if none was declared. Parameters: systemId - The declared system identifier for theexternal DTD subset, or null if none was declared. throws: org.xml.sax.SAXException - The application may raise anexception. See Also: ToStream.endDTD See Also: ToStream.startEntity |
startNonEscaping | public void startNonEscaping() throws org.xml.sax.SAXException(Code) | | Starts an un-escaping section. All characters printed within an un-
escaping section are printed as is, without escaping special characters
into entity references. Only XML and HTML serializers need to support
this method.
The contents of the un-escaping section will be delivered through the
regular characters event.
throws: org.xml.sax.SAXException - |
startPrefixMapping | public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException(Code) | | Begin the scope of a prefix-URI Namespace mapping
just before another element is about to start.
This call will close any open tags so that the prefix mapping
will not apply to the current element, but the up comming child.
See Also: org.xml.sax.ContentHandler.startPrefixMapping Parameters: prefix - The Namespace prefix being declared. Parameters: uri - The Namespace URI the prefix is mapped to. throws: org.xml.sax.SAXException - The client may throwan exception during processing. |
startPrefixMapping | public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws org.xml.sax.SAXException(Code) | | Handle a prefix/uri mapping, which is associated with a startElement()
that is soon to follow. Need to close any open start tag to make
sure than any name space attributes due to this event are associated wih
the up comming element, not the current one.
See Also: ExtendedContentHandler.startPrefixMapping Parameters: prefix - The Namespace prefix being declared. Parameters: uri - The Namespace URI the prefix is mapped to. Parameters: shouldFlush - true if any open tags need to be closed first, thiswill impact which element the mapping applies to (open parent, or its upcomming child) returns true if the call made a change to the current namespace information, false if it did not change anything, e.g. if theprefix/namespace mapping was already in scope from before. throws: org.xml.sax.SAXException - The client may throwan exception during processing. |
writeAttrString | public void writeAttrString(Writer writer, String string, String encoding) throws IOException(Code) | | Returns the specified string after substituting specials,
and UTF-16 surrogates for chracter references &#xnn .
Parameters: string - String to convert to XML format. Parameters: encoding - CURRENTLY NOT IMPLEMENTED. throws: java.io.IOException - |
writeNormalizedChars | void writeNormalizedChars(char ch, int start, int length, boolean isCData, boolean useSystemLineSeparator) throws IOException, org.xml.sax.SAXException(Code) | | Normalize the characters, but don't escape.
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. Parameters: isCData - true if a CDATA block should be built around the characters. Parameters: useSystemLineSeparator - true if the operating systems end-of-line separator should be output rather than a new-line character. throws: IOException - throws: org.xml.sax.SAXException - |
writeUTF16Surrogate | protected int writeUTF16Surrogate(char c, char ch, int i, int end) throws IOException(Code) | | Once a surrogate has been detected, write out the pair of
characters if it is in the encoding, or if there is no
encoding, otherwise write out an entity reference
of the value of the unicode code point of the character
represented by the high/low surrogate pair.
An exception is thrown if there is no low surrogate in the pair,
because the array ends unexpectely, or if the low char is there
but its value is such that it is not a low surrogate.
Parameters: c - the first (high) part of the surrogate, whichmust be confirmed before calling this method. Parameters: ch - Character array. Parameters: i - position Where the surrogate was detected. Parameters: end - The end index of the significant characters. 0 if the pair of characters was written out as-is,the unicode code point of the character represented bythe surrogate pair if an entity reference with that valuewas written out. throws: IOException - throws: org.xml.sax.SAXException - if invalid UTF-16 surrogate detected. |
Methods inherited from org.apache.xml.serializer.SerializerBase | public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException(Code)(Java Doc) public void addAttribute(String name, String value)(Code)(Java Doc) public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException(Code)(Java Doc) public boolean addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute)(Code)(Java Doc) public void addAttributes(Attributes atts) throws SAXException(Code)(Java Doc) public void addXSLAttribute(String name, String value, String uri)(Code)(Java Doc) public ContentHandler asContentHandler() throws IOException(Code)(Java Doc) public DOMSerializer asDOMSerializer() throws IOException(Code)(Java Doc) public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException(Code)(Java Doc) public void close()(Code)(Java Doc) public void comment(String data) throws SAXException(Code)(Java Doc) public void endEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc) public void entityReference(String name) throws org.xml.sax.SAXException(Code)(Java Doc) public void error(SAXParseException exc) throws SAXException(Code)(Java Doc) public void fatalError(SAXParseException exc) throws SAXException(Code)(Java Doc) protected void fireCDATAEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireCharEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireCommentEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireEndDoc() throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireEndElem(String name) throws org.xml.sax.SAXException(Code)(Java Doc) public void fireEndEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireEntityReference(String name) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireEscapingEvent(String name, String data) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireStartDoc() throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireStartElem(String elemName) throws org.xml.sax.SAXException(Code)(Java Doc) protected void fireStartEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc) public String getDoctypePublic()(Code)(Java Doc) public String getDoctypeSystem()(Code)(Java Doc) public String getEncoding()(Code)(Java Doc) public boolean getIndent()(Code)(Java Doc) public int getIndentAmount()(Code)(Java Doc) protected static String getLocalName(String qname)(Code)(Java Doc) public String getMediaType()(Code)(Java Doc) public NamespaceMappings getNamespaceMappings()(Code)(Java Doc) public String getNamespaceURI(String qname, boolean isElement)(Code)(Java Doc) public String getNamespaceURIFromPrefix(String prefix)(Code)(Java Doc) public boolean getOmitXMLDeclaration()(Code)(Java Doc) public String getPrefix(String namespaceURI)(Code)(Java Doc) final protected static String getPrefixPart(String qname)(Code)(Java Doc) public String getStandalone()(Code)(Java Doc) public Transformer getTransformer()(Code)(Java Doc) public String getVersion()(Code)(Java Doc) final boolean inTemporaryOutputState()(Code)(Java Doc) protected void initCDATA()(Code)(Java Doc) protected boolean isCdataSection()(Code)(Java Doc) public void namespaceAfterStartElement(String uri, String prefix) throws SAXException(Code)(Java Doc) public void notationDecl(String arg0, String arg1, String arg2) throws SAXException(Code)(Java Doc) protected String patchName(String qname)(Code)(Java Doc) public boolean reset()(Code)(Java Doc) public void setDTDEntityExpansion(boolean expand)(Code)(Java Doc) public void setDoctype(String doctypeSystem, String doctypePublic)(Code)(Java Doc) public void setDoctypePublic(String doctypePublic)(Code)(Java Doc) public void setDoctypeSystem(String doctypeSystem)(Code)(Java Doc) public void setDocumentLocator(Locator locator)(Code)(Java Doc) public void setEncoding(String m_encoding)(Code)(Java Doc) public void setIndent(boolean doIndent)(Code)(Java Doc) public void setIndentAmount(int m_indentAmount)(Code)(Java Doc) public void setMediaType(String mediaType)(Code)(Java Doc) public void setNamespaceMappings(NamespaceMappings mappings)(Code)(Java Doc) public void setOmitXMLDeclaration(boolean b)(Code)(Java Doc) public void setSourceLocator(SourceLocator locator)(Code)(Java Doc) public void setStandalone(String standalone)(Code)(Java Doc) protected void setStandaloneInternal(String standalone)(Code)(Java Doc) public void setTransformer(Transformer t)(Code)(Java Doc) public void setVersion(String version)(Code)(Java Doc) public void startDocument() throws org.xml.sax.SAXException(Code)(Java Doc) protected void startDocumentInternal() throws org.xml.sax.SAXException(Code)(Java Doc) public void unparsedEntityDecl(String arg0, String arg1, String arg2, String arg3) throws SAXException(Code)(Java Doc) public void warning(SAXParseException exc) throws SAXException(Code)(Java Doc)
|
|
|