Class ToTextSAXHandler
- All Implemented Interfaces:
DOMSerializer,ExtendedContentHandler,ExtendedLexicalHandler,SerializationHandler,Serializer,ContentHandler,DTDHandler,ErrorHandler,DeclHandler,LexicalHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTo insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >static final StringThe constant "]]>"static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringDefine the XML version.Fields inherited from class org.apache.xml.serializer.SerializerBase
PKG_NAME, PKG_PATHFields inherited from interface org.apache.xml.serializer.ExtendedContentHandler
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS -
Constructor Summary
ConstructorsConstructorDescriptionToTextSAXHandler(ContentHandler handler, String encoding) Deprecated.From XSLTCToTextSAXHandler(ContentHandler hdlr, LexicalHandler lex, String encoding) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, String value) Deprecated.From XSLTCvoidaddAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) Deprecated.Adds the given attribute to the set of collected attributes , but only if there is a currently open element.voidDeprecated.voidcharacters(char[] characters, int offset, int length) Deprecated.voidcharacters(String characters) Deprecated.Receive notification of character data.voidcomment(char[] ch, int start, int length) Deprecated.voidDeprecated.Receive notification of a comment.voidelementDecl(String arg0, String arg1) Deprecated.voidendCDATA()Deprecated.voidDeprecated.From XSLTCvoidendDTD()Deprecated.voidendElement(String elemName) Deprecated.From XSLTCvoidendElement(String arg0, String arg1, String arg2) Deprecated.voidendPrefixMapping(String arg0) Deprecated.voidexternalEntityDecl(String arg0, String arg1, String arg2) Deprecated.Deprecated.Returns the output format properties for this serializer.Deprecated.Get the output stream where the events will be serialized to.Deprecated.Get the character stream where the events will be serialized to.voidignorableWhitespace(char[] arg0, int arg1, int arg2) Deprecated.voidindent(int n) Deprecated.Does nothing because the indent attribute is ignored for text output.voidinternalEntityDecl(String arg0, String arg1) Deprecated.voidnamespaceAfterStartElement(String prefix, 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().voidprocessingInstruction(String arg0, String arg1) Deprecated.From XSLTCbooleanreset()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).voidDeprecated.Notify that the serializer should take this DOM node as input to be serialized.voidsetDocumentLocator(Locator arg0) Deprecated.Receive an object for locating the origin of SAX document events.booleansetEscaping(boolean escape) Deprecated.Turns special character escaping on/off.voidsetIndent(boolean indent) Deprecated.Sets the value coming from the xsl:output indent stylesheet attribute.voidsetOutputFormat(Properties format) Deprecated.Specifies an output format for this serializer.voidsetOutputStream(OutputStream output) Deprecated.Specifies an output stream to which the document should be serialized.voidDeprecated.Specifies a writer to which the document should be serialized.voidskippedEntity(String arg0) Deprecated.voidDeprecated.voidstartElement(String elementName) Deprecated.An element starts, but attributes are not fully known yet.voidstartElement(String elementNamespaceURI, String elementLocalName, String elementName) Deprecated.From XSLTCvoidstartElement(String arg0, String arg1, String arg2, 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.voidstartEntity(String arg0) Deprecated.voidstartPrefixMapping(String prefix, String uri) Deprecated.booleanstartPrefixMapping(String prefix, 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, error, fatalError, flushPending, setCdataSectionElements, setContentHandler, setLexHandler, setShouldOutputNSAttr, setTransformState, startDTD, warningMethods inherited from class org.apache.xml.serializer.SerializerBase
addAttribute, addAttributeAlways, addAttributes, addXSLAttribute, asContentHandler, asDOM3Serializer, asDOMSerializer, close, documentIsEmpty, endEntity, entityReference, fireEndEntity, getDoctypePublic, getDoctypeSystem, getEncoding, getIndent, getIndentAmount, getMediaType, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getOmitXMLDeclaration, getOutputProperty, getOutputPropertyDefault, getOutputPropertyNonDefault, getPrefix, getStandalone, getTransformer, getVersion, notationDecl, setDoctype, setDoctypePublic, setDoctypeSystem, setDTDEntityExpansion, setEncoding, setIndentAmount, setMediaType, setNamespaceMappings, setOmitXMLDeclaration, setOutputProperty, setOutputPropertyDefault, setSourceLocator, setStandalone, setTransformer, setVersion, startDocument, unparsedEntityDeclMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
CDATA_CONTINUE
To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >- See Also:
-
CDATA_DELIMITER_CLOSE
The constant "]]>"- See Also:
-
CDATA_DELIMITER_OPEN
- See Also:
-
EMPTYSTRING
- See Also:
-
ENTITY_AMP
- See Also:
-
ENTITY_CRLF
- See Also:
-
ENTITY_GT
- See Also:
-
ENTITY_LT
- See Also:
-
ENTITY_QUOT
- See Also:
-
XML_PREFIX
- See Also:
-
XMLNS_PREFIX
- See Also:
-
XMLNS_URI
- See Also:
-
DEFAULT_SAX_SERIALIZER
-
XMLVERSION11
Define the XML version.- See Also:
-
XMLVERSION10
- See Also:
-
-
Constructor Details
-
ToTextSAXHandler
Deprecated. -
ToTextSAXHandler
Deprecated.From XSLTC
-
-
Method Details
-
endElement
Deprecated.From XSLTC- Parameters:
elemName- the fully qualified element name.- Throws:
SAXException- See Also:
-
endElement
Deprecated.- Throws:
SAXException- See Also:
-
comment
Deprecated.- Throws:
SAXException
-
comment
Deprecated.Description copied from class:ToSAXHandlerReceive notification of a comment.- Specified by:
commentin interfaceExtendedLexicalHandler- Overrides:
commentin classToSAXHandler- Parameters:
data- the comment, but unlike the SAX comment() method this method takes a String rather than a character array.- Throws:
SAXException- See Also:
-
getOutputFormat
Deprecated.Description copied from interface:SerializerReturns the output format properties for this serializer.- Returns:
- The output format key/value pairs in use.
- See Also:
-
getOutputStream
Deprecated.Description copied from interface:SerializerGet 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:
-
getWriter
Deprecated.Description copied from interface:SerializerGet the character stream where the events will be serialized to.- Returns:
- Reference to the result Writer, or null.
- See Also:
-
indent
Deprecated.Does nothing because the indent attribute is ignored for text output.- Throws:
SAXException
-
reset
public boolean reset()Deprecated.Description copied from class:ToSAXHandlerTry'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:
resetin interfaceSerializer- Overrides:
resetin classToSAXHandler- Returns:
- true if the class was successfuly reset.
- See Also:
-
serialize
Deprecated.Description copied from interface:SerializationHandlerNotify that the serializer should take this DOM node as input to be serialized.- Parameters:
node- the DOM node to be serialized.- Throws:
IOException- if an I/O exception occured while serializing- See Also:
-
setEscaping
public boolean setEscaping(boolean escape) Deprecated.Description copied from interface:SerializationHandlerTurns 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:
-
setIndent
public void setIndent(boolean indent) Deprecated.Description copied from class:SerializerBaseSets the value coming from the xsl:output indent stylesheet attribute.- Overrides:
setIndentin classSerializerBase- Parameters:
indent- true if the output document should be indented to visually indicate its structure.- See Also:
-
XSLOutputAttributes.setIndent(boolean)
-
setOutputFormat
Deprecated.Description copied from interface:SerializerSpecifies 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 {@link <a href="http://www.w3.org/TR/1999/REC-xslt-19991116"> 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:
-
setOutputStream
Deprecated.Description copied from interface:SerializerSpecifies 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
Propertiesis 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:
-
setWriter
Deprecated.Description copied from interface:SerializerSpecifies 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
Propertiesmust 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:
-
addAttribute
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) Deprecated.Description copied from class:SerializerBaseAdds 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:
addAttributein interfaceExtendedContentHandler- Overrides:
addAttributein classSerializerBase- Parameters:
uri- the URI of the attributelocalName- the local name of the attributerawName- the qualified name of the attributetype- the type of the attribute (probably CDATA)value- the value of the attributeXSLAttribute- true if this attribute is coming from an xsl:attriute element- See Also:
-
attributeDecl
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException Deprecated. -
elementDecl
Deprecated.- Throws:
SAXException- See Also:
-
externalEntityDecl
Deprecated.- Throws:
SAXException- See Also:
-
internalEntityDecl
Deprecated.- Throws:
SAXException- See Also:
-
endPrefixMapping
Deprecated.- Throws:
SAXException- See Also:
-
ignorableWhitespace
Deprecated.- Throws:
SAXException- See Also:
-
processingInstruction
Deprecated.From XSLTC- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classToSAXHandler- Throws:
SAXException- See Also:
-
setDocumentLocator
Deprecated.Description copied from class:SerializerBaseReceive an object for locating the origin of SAX document events.- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classSerializerBase- 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:
-
skippedEntity
Deprecated.- Throws:
SAXException- See Also:
-
startElement
public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException Deprecated.Description copied from class:ToSAXHandlerReceive 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:
startElementin interfaceContentHandler- Overrides:
startElementin classToSAXHandler- Throws:
SAXException- See Also:
-
endCDATA
Deprecated.- Throws:
SAXException- See Also:
-
endDTD
Deprecated.- Throws:
SAXException- See Also:
-
startCDATA
Deprecated.- Throws:
SAXException- See Also:
-
startEntity
Deprecated.- Throws:
SAXException- See Also:
-
startElement
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException Deprecated.From XSLTC- Specified by:
startElementin interfaceExtendedContentHandler- Overrides:
startElementin classToSAXHandler- 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:
SAXException- See Also:
-
startElement
Deprecated.Description copied from class:ToSAXHandlerAn element starts, but attributes are not fully known yet.- Specified by:
startElementin interfaceExtendedContentHandler- Overrides:
startElementin classToSAXHandler- Parameters:
elementName- the element name, with prefix (if any).- Throws:
SAXException- See Also:
-
endDocument
Deprecated.From XSLTC- Throws:
SAXException- See Also:
-
characters
Deprecated.Description copied from class:ToSAXHandlerReceive notification of character data.- Specified by:
charactersin interfaceExtendedContentHandler- Overrides:
charactersin classToSAXHandler- Parameters:
characters- The string of characters to process.- Throws:
SAXException- See Also:
-
characters
Deprecated.- Throws:
SAXException- See Also:
-
addAttribute
Deprecated.From XSLTC- Specified by:
addAttributein interfaceExtendedContentHandler- Overrides:
addAttributein classSerializerBase- Parameters:
name- the attribute's qualified namevalue- the value of the attribute
-
startPrefixMapping
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException Deprecated.Description copied from interface:ExtendedContentHandlerThis 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 URIuri- the namespace URI of the given prefixshouldFlush- 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:
SAXException
-
startPrefixMapping
Deprecated.- Throws:
SAXException
-
namespaceAfterStartElement
Deprecated.Description copied from class:SerializerBaseThis 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:
namespaceAfterStartElementin interfaceExtendedContentHandler- Overrides:
namespaceAfterStartElementin classSerializerBase- Parameters:
prefix- the URI of the namespaceuri- the prefix associated with the given URI.- Throws:
SAXException- See Also:
-
ToXMLSAXHandler.