org.apache.xml.serializer
Class ToTextSAXHandler

java.lang.Object
  extended by org.apache.xml.serializer.SerializerBase
      extended by org.apache.xml.serializer.ToSAXHandler
          extended by org.apache.xml.serializer.ToTextSAXHandler
All Implemented Interfaces:
DOMSerializer, ExtendedContentHandler, ExtendedLexicalHandler, SerializationHandler, Serializer, SerializerConstants, XSLOutputAttributes, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.DeclHandler, org.xml.sax.ext.LexicalHandler

Deprecated. As of Xalan 2.7.1, replaced by the use of ToXMLSAXHandler.

public final class ToTextSAXHandler
extends ToSAXHandler

This class converts SAX-like event to SAX events for xsl:output method "text". This class is only to be used internally. This class is not a public API.


Field Summary
 
Fields inherited from class org.apache.xml.serializer.ToSAXHandler
m_lexHandler, m_saxHandler, m_state
 
Fields inherited from class org.apache.xml.serializer.SerializerBase
m_attrBuff, m_attributes, m_CdataElems, m_cdataTagOpen, m_charsBuff, m_docIsEmpty, m_doctypePublic, m_doctypeSystem, m_doIndent, m_elemContext, m_indentAmount, m_inEntityRef, m_inExternalDTD, m_mediatype, m_needToCallStartDocument, m_needToOutputDocTypeDecl, m_prefixMap, m_shouldNotWriteXMLHeader, m_sourceLocator, m_standaloneWasSpecified, m_StringOfCDATASections, m_tracer, m_version, m_writer, PKG_NAME, PKG_PATH
 
Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS
 
Fields inherited from interface org.apache.xml.serializer.SerializerConstants
CDATA_CONTINUE, CDATA_DELIMITER_CLOSE, CDATA_DELIMITER_OPEN, DEFAULT_SAX_SERIALIZER, EMPTYSTRING, ENTITY_AMP, ENTITY_CRLF, ENTITY_GT, ENTITY_LT, ENTITY_QUOT, XML_PREFIX, XMLNS_PREFIX, XMLNS_URI, XMLVERSION10, XMLVERSION11
 
Constructor Summary
ToTextSAXHandler(org.xml.sax.ContentHandler hdlr, org.xml.sax.ext.LexicalHandler lex, java.lang.String encoding)
          Deprecated.  
ToTextSAXHandler(org.xml.sax.ContentHandler handler, java.lang.String encoding)
          Deprecated. From XSLTC
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String value)
          Deprecated. From XSLTC
 void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute)
          Deprecated. Adds the given attribute to the set of collected attributes , but only if there is a currently open element.
 void attributeDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)
          Deprecated.  
 void characters(char[] characters, int offset, int length)
          Deprecated.  
 void characters(java.lang.String characters)
          Deprecated. Receive notification of character data.
 void comment(char[] ch, int start, int length)
          Deprecated.  
 void comment(java.lang.String data)
          Deprecated. Receive notification of a comment.
 void elementDecl(java.lang.String arg0, java.lang.String arg1)
          Deprecated.  
 void endCDATA()
          Deprecated.  
 void endDocument()
          Deprecated. From XSLTC
 void endDTD()
          Deprecated.  
 void endElement(java.lang.String elemName)
          Deprecated. From XSLTC
 void endElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
          Deprecated.  
 void endPrefixMapping(java.lang.String arg0)
          Deprecated.  
 void externalEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
          Deprecated.  
 java.util.Properties getOutputFormat()
          Deprecated. Returns the output format properties for this serializer.
 java.io.OutputStream getOutputStream()
          Deprecated. Get the output stream where the events will be serialized to.
 java.io.Writer getWriter()
          Deprecated. Get the character stream where the events will be serialized to.
 void ignorableWhitespace(char[] arg0, int arg1, int arg2)
          Deprecated.  
 void indent(int n)
          Deprecated. Does nothing because the indent attribute is ignored for text output.
 void internalEntityDecl(java.lang.String arg0, java.lang.String arg1)
          Deprecated.  
 void namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri)
          Deprecated. This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement().
 void processingInstruction(java.lang.String arg0, java.lang.String arg1)
          Deprecated. From XSLTC
 boolean reset()
          Deprecated. 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).
 void serialize(org.w3c.dom.Node node)
          Deprecated. Serializes the DOM node.
 void setDocumentLocator(org.xml.sax.Locator arg0)
          Deprecated. Receive an object for locating the origin of SAX document events.
 boolean setEscaping(boolean escape)
          Deprecated. Turns special character escaping on/off.
 void setIndent(boolean indent)
          Deprecated. Sets the value coming from the xsl:output indent stylesheet attribute.
 void setOutputFormat(java.util.Properties format)
          Deprecated. Specifies an output format for this serializer.
 void setOutputStream(java.io.OutputStream output)
          Deprecated. Specifies an output stream to which the document should be serialized.
 void setWriter(java.io.Writer writer)
          Deprecated. Specifies a writer to which the document should be serialized.
 void skippedEntity(java.lang.String arg0)
          Deprecated.  
 void startCDATA()
          Deprecated.  
 void startElement(java.lang.String elementName)
          Deprecated. An element starts, but attributes are not fully known yet.
 void startElement(java.lang.String elementNamespaceURI, java.lang.String elementLocalName, java.lang.String elementName)
          Deprecated. From XSLTC
 void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, org.xml.sax.Attributes arg3)
          Deprecated. 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.
 void startEntity(java.lang.String arg0)
          Deprecated.  
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Deprecated.  
 boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush)
          Deprecated. This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.
 
Methods inherited from class org.apache.xml.serializer.ToSAXHandler
addUniqueAttribute, characters, closeCDATA, closeStartTag, error, fatalError, flushPending, getShouldOutputNSAttr, setCdataSectionElements, setContentHandler, setLexHandler, setShouldOutputNSAttr, setTransformState, startDocumentInternal, startDTD, warning
 
Methods inherited from class org.apache.xml.serializer.SerializerBase
addAttribute, addAttributeAlways, addAttributes, addXSLAttribute, asContentHandler, asDOM3Serializer, asDOMSerializer, close, documentIsEmpty, endEntity, entityReference, fireCDATAEvent, fireCharEvent, fireCommentEvent, fireEndDoc, fireEndElem, fireEndEntity, fireEntityReference, fireEscapingEvent, fireStartDoc, fireStartElem, fireStartEntity, getDoctypePublic, getDoctypeSystem, getEncoding, getFirstCharLocName, getIndent, getIndentAmount, getLocalName, getMediaType, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getOmitXMLDeclaration, getOutputPropDefaultKeys, getOutputProperty, getOutputPropertyDefault, getOutputPropertyNonDefault, getOutputPropKeys, getPrefix, getPrefixPart, getStandalone, getTransformer, getVersion, initCDATA, initCdataElems, inTemporaryOutputState, isCdataSection, notationDecl, patchName, setDoctype, setDoctypePublic, setDoctypeSystem, setDTDEntityExpansion, setEncoding, setIndentAmount, setMediaType, setNamespaceMappings, setOmitXMLDeclaration, setOutputProperty, setOutputPropertyDefault, setProp, setSourceLocator, setStandalone, setStandaloneInternal, setTransformer, setVersion, startDocument, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToTextSAXHandler

public ToTextSAXHandler(org.xml.sax.ContentHandler hdlr,
                        org.xml.sax.ext.LexicalHandler lex,
                        java.lang.String encoding)
Deprecated. 

ToTextSAXHandler

public ToTextSAXHandler(org.xml.sax.ContentHandler handler,
                        java.lang.String encoding)
Deprecated. 
From XSLTC

Method Detail

endElement

public void endElement(java.lang.String elemName)
                throws org.xml.sax.SAXException
Deprecated. 
From XSLTC

Parameters:
elemName - the fully qualified element name.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.endElement(String)

endElement

public void endElement(java.lang.String arg0,
                       java.lang.String arg1,
                       java.lang.String arg2)
                throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endElement(String, String, String)

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException

comment

public void comment(java.lang.String data)
             throws org.xml.sax.SAXException
Deprecated. 
Description copied from class: ToSAXHandler
Receive notification of a comment.

Specified by:
comment in interface ExtendedLexicalHandler
Overrides:
comment in class ToSAXHandler
Parameters:
data - the comment, but unlike the SAX comment() method this method takes a String rather than a character array.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedLexicalHandler.comment(String)

getOutputFormat

public java.util.Properties getOutputFormat()
Deprecated. 
Description copied from interface: Serializer
Returns the output format properties for this serializer.

Returns:
The output format key/value pairs in use.
See Also:
Serializer.getOutputFormat()

getOutputStream

public java.io.OutputStream getOutputStream()
Deprecated. 
Description copied from interface: Serializer
Get the output stream where the events will be serialized to.

Returns:
reference to the result stream, or null if only a writer was set.
See Also:
Serializer.getOutputStream()

getWriter

public java.io.Writer getWriter()
Deprecated. 
Description copied from interface: Serializer
Get the character stream where the events will be serialized to.

Returns:
Reference to the result Writer, or null.
See Also:
Serializer.getWriter()

indent

public void indent(int n)
            throws org.xml.sax.SAXException
Deprecated. 
Does nothing because the indent attribute is ignored for text output.

Throws:
org.xml.sax.SAXException

reset

public boolean reset()
Deprecated. 
Description copied from class: ToSAXHandler
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).

Specified by:
reset in interface Serializer
Overrides:
reset in class ToSAXHandler
Returns:
true if the class was successfuly reset.
See Also:
Serializer.reset()

serialize

public void serialize(org.w3c.dom.Node node)
               throws java.io.IOException
Deprecated. 
Description copied from interface: DOMSerializer
Serializes the DOM node. Throws an exception only if an I/O exception occured while serializing. This interface is a public API.

Parameters:
node - the DOM node to serialize
Throws:
java.io.IOException - if an I/O exception occured while serializing
See Also:
DOMSerializer.serialize(Node)

setEscaping

public boolean setEscaping(boolean escape)
Deprecated. 
Description copied from interface: SerializationHandler
Turns special character escaping on/off. Note that characters will never, even if this option is set to 'true', be escaped within CDATA sections in output XML documents.

Parameters:
escape - true if escaping is to be set on.
See Also:
SerializationHandler.setEscaping(boolean)

setIndent

public void setIndent(boolean indent)
Deprecated. 
Description copied from class: SerializerBase
Sets the value coming from the xsl:output indent stylesheet attribute.

Specified by:
setIndent in interface XSLOutputAttributes
Overrides:
setIndent in class SerializerBase
Parameters:
indent - true if the output document should be indented to visually indicate its structure.
See Also:
XSLOutputAttributes.setIndent(boolean)

setOutputFormat

public void setOutputFormat(java.util.Properties format)
Deprecated. 
Description copied from interface: Serializer
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.

The standard property keys supported are: "method", "version", "encoding", "omit-xml-declaration", "standalone", doctype-public", "doctype-system", "cdata-section-elements", "indent", "media-type". These property keys and their values are described in the XSLT recommendation, see XSLT 1.0 recommendation

The non-standard property keys supported are defined in OutputPropertiesFactory.

This method can be called multiple times before a document is serialized. Each time it is called more, or over-riding property values, can be specified. One property value that can not be changed is that of the "method" property key.

The value of the "cdata-section-elements" property key is a whitespace separated list of elements. If the element is in a namespace then value is passed in this format: {uri}localName

If the "cdata-section-elements" key is specified on multiple calls to this method the set of elements specified in the value is not replaced from one call to the next, but it is cumulative across the calls.

Parameters:
format - The output format to use, as a set of key/value pairs.
See Also:
Serializer.setOutputFormat(Properties)

setOutputStream

public void setOutputStream(java.io.OutputStream output)
Deprecated. 
Description copied from interface: Serializer
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.

Only one of setWriter() or setOutputStream() should be called.

Parameters:
output - The output stream
See Also:
Serializer.setOutputStream(OutputStream)

setWriter

public void setWriter(java.io.Writer writer)
Deprecated. 
Description copied from interface: Serializer
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.

The encoding specified for the output Properties must be identical to the output format used with the writer.

Only one of setWriter() or setOutputStream() should be called.

Parameters:
writer - The output writer stream
See Also:
Serializer.setWriter(Writer)

addAttribute

public void addAttribute(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String rawName,
                         java.lang.String type,
                         java.lang.String value,
                         boolean XSLAttribute)
Deprecated. 
Description copied from class: SerializerBase
Adds the given attribute to the set of collected attributes , but only if there is a currently open element. An element is currently open if a startElement() notification has occured but the start of the element has not yet been written to the output. In the stream case this means that we have not yet been forced to close the elements opening tag by another notification, such as a character notification.

Specified by:
addAttribute in interface ExtendedContentHandler
Overrides:
addAttribute in class SerializerBase
Parameters:
uri - the URI of the attribute
localName - the local name of the attribute
rawName - the qualified name of the attribute
type - the type of the attribute (probably CDATA)
value - the value of the attribute
XSLAttribute - true if this attribute is coming from an xsl:attriute element
See Also:
ExtendedContentHandler.addAttribute(String, String, String, String, String)

attributeDecl

public void attributeDecl(java.lang.String arg0,
                          java.lang.String arg1,
                          java.lang.String arg2,
                          java.lang.String arg3,
                          java.lang.String arg4)
                   throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
DeclHandler.attributeDecl(String, String, String, String, String)

elementDecl

public void elementDecl(java.lang.String arg0,
                        java.lang.String arg1)
                 throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
DeclHandler.elementDecl(String, String)

externalEntityDecl

public void externalEntityDecl(java.lang.String arg0,
                               java.lang.String arg1,
                               java.lang.String arg2)
                        throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
DeclHandler.externalEntityDecl(String, String, String)

internalEntityDecl

public void internalEntityDecl(java.lang.String arg0,
                               java.lang.String arg1)
                        throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
DeclHandler.internalEntityDecl(String, String)

endPrefixMapping

public void endPrefixMapping(java.lang.String arg0)
                      throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endPrefixMapping(String)

ignorableWhitespace

public void ignorableWhitespace(char[] arg0,
                                int arg1,
                                int arg2)
                         throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String arg0,
                                  java.lang.String arg1)
                           throws org.xml.sax.SAXException
Deprecated. 
From XSLTC

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Overrides:
processingInstruction in class ToSAXHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.processingInstruction(String, String)

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator arg0)
Deprecated. 
Description copied from class: SerializerBase
Receive an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class SerializerBase
Parameters:
arg0 - An object that can return the location of any SAX document event. Receive an object for locating the origin of SAX document events.

SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.

See Also:
ContentHandler.setDocumentLocator(Locator)

skippedEntity

public void skippedEntity(java.lang.String arg0)
                   throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.skippedEntity(String)

startElement

public void startElement(java.lang.String arg0,
                         java.lang.String arg1,
                         java.lang.String arg2,
                         org.xml.sax.Attributes arg3)
                  throws org.xml.sax.SAXException
Deprecated. 
Description copied from class: ToSAXHandler
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.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class ToSAXHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(String, String, String, Attributes)

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.endCDATA()

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.endDTD()

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.startCDATA()

startEntity

public void startEntity(java.lang.String arg0)
                 throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
LexicalHandler.startEntity(String)

startElement

public void startElement(java.lang.String elementNamespaceURI,
                         java.lang.String elementLocalName,
                         java.lang.String elementName)
                  throws org.xml.sax.SAXException
Deprecated. 
From XSLTC

Specified by:
startElement in interface ExtendedContentHandler
Overrides:
startElement in class ToSAXHandler
Parameters:
elementNamespaceURI - the URI of the namespace of the element (optional)
elementLocalName - the element name, but without prefix (optional)
elementName - the element name, with prefix, if any (required)
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.startElement(String)

startElement

public void startElement(java.lang.String elementName)
                  throws org.xml.sax.SAXException
Deprecated. 
Description copied from class: ToSAXHandler
An element starts, but attributes are not fully known yet.

Specified by:
startElement in interface ExtendedContentHandler
Overrides:
startElement in class ToSAXHandler
Parameters:
elementName - the element name, with prefix (if any).
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.startElement(String)

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Deprecated. 
From XSLTC

Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endDocument()

characters

public void characters(java.lang.String characters)
                throws org.xml.sax.SAXException
Deprecated. 
Description copied from class: ToSAXHandler
Receive notification of character data.

Specified by:
characters in interface ExtendedContentHandler
Overrides:
characters in class ToSAXHandler
Parameters:
characters - The string of characters to process.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.characters(String)

characters

public void characters(char[] characters,
                       int offset,
                       int length)
                throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.characters(char[], int, int)

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String value)
Deprecated. 
From XSLTC

Specified by:
addAttribute in interface ExtendedContentHandler
Overrides:
addAttribute in class SerializerBase
Parameters:
name - the attribute's qualified name
value - the value of the attribute

startPrefixMapping

public boolean startPrefixMapping(java.lang.String prefix,
                                  java.lang.String uri,
                                  boolean shouldFlush)
                           throws org.xml.sax.SAXException
Deprecated. 
Description copied from interface: ExtendedContentHandler
This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.

Parameters:
prefix - the prefix that maps to the given URI
uri - the namespace URI of the given prefix
shouldFlush - if true this call is like the SAX startPrefixMapping(prefix,uri) call and the mapping applies to the element to come. If false the mapping applies to the current element.
Returns:
boolean false if the prefix mapping was already in effect (in other words we are just re-declaring), true if this is a new, never before seen mapping for the element.
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Deprecated. 
Throws:
org.xml.sax.SAXException

namespaceAfterStartElement

public void namespaceAfterStartElement(java.lang.String prefix,
                                       java.lang.String uri)
                                throws org.xml.sax.SAXException
Deprecated. 
Description copied from class: SerializerBase
This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). startPrefixMapping(prefix,uri) would be used before the startElement() call.

Specified by:
namespaceAfterStartElement in interface ExtendedContentHandler
Overrides:
namespaceAfterStartElement in class SerializerBase
Parameters:
prefix - the URI of the namespace
uri - the prefix associated with the given URI.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.namespaceAfterStartElement(String, String)