Class ToHTMLSAXHandler
- 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
ConstructorsConstructorDescriptionToHTMLSAXHandler(ContentHandler handler, String encoding) Deprecated.A constructorToHTMLSAXHandler(ContentHandler handler, LexicalHandler lex, String encoding) Deprecated.A constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Does nothing.voidcharacters(char[] ch, int off, int len) Deprecated.Receive notification of character data.voidcharacters(String chars) Deprecated.Receive notification of character data.voidclose()Deprecated.Do nothing.voidcomment(char[] ch, int start, int length) Deprecated.Receive notification of a comment anywhere in the document.voidelementDecl(String name, String model) Deprecated.Does nothing.voidendCDATA()Deprecated.Does nothing.voidDeprecated.Receive notification of the end of a document.voidendDTD()Deprecated.Does nothing.voidendElement(String elementName) Deprecated.Receive notification of the end of an element.voidendElement(String uri, String localName, String qName) Deprecated.Receive notification of the end of an element.voidendPrefixMapping(String prefix) Deprecated.Does nothing.voidexternalEntityDecl(String arg0, String arg1, String arg2) Deprecated.voidDeprecated.This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.Deprecated.Returns null.Deprecated.Reurns nullDeprecated.Returns nullvoidignorableWhitespace(char[] ch, int start, int length) Deprecated.Does nothing.voidindent(int n) Deprecated.Does nothing.voidinternalEntityDecl(String name, String value) Deprecated.Does nothing.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 target, String data) Deprecated.Receive notification of a processing instruction.booleanreset()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.Does nothing.voidsetDocumentLocator(Locator arg0) Deprecated.Does nothing.booleansetEscaping(boolean escape) Deprecated.Turns special character escaping on/off.voidsetIndent(boolean indent) Deprecated.Does nothingvoidsetOutputFormat(Properties format) Deprecated.Does nothing.voidsetOutputStream(OutputStream output) Deprecated.Does nothing.voidDeprecated.Does nothing.voidskippedEntity(String arg0) Deprecated.Does nothing.voidDeprecated.Does nothing.voidstartElement(String elementName) Deprecated.An element starts, but attributes are not fully known yet.voidstartElement(String elementNamespaceURI, String elementLocalName, String elementName) Deprecated.An element starts, but attributes are not fully known yet.voidstartElement(String namespaceURI, String localName, String qName, Attributes atts) 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.Does nothing.voidstartPrefixMapping(String prefix, String uri) Deprecated.Begin the scope of a prefix-URI Namespace mapping just before another element is about to start.booleanstartPrefixMapping(String prefix, String uri, boolean shouldFlush) Deprecated.Handle a prefix/uri mapping, which is associated with a startElement() that is soon to follow.Methods inherited from class org.apache.xml.serializer.ToSAXHandler
addUniqueAttribute, characters, comment, error, fatalError, setCdataSectionElements, setContentHandler, setLexHandler, setShouldOutputNSAttr, setTransformState, startDTD, warningMethods inherited from class org.apache.xml.serializer.SerializerBase
addAttribute, addAttribute, addAttribute, addAttributeAlways, addAttributes, addXSLAttribute, asContentHandler, asDOM3Serializer, asDOMSerializer, 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
-
ToHTMLSAXHandler
Deprecated.A constructor- Parameters:
handler- the wrapped SAX content handlerencoding- the encoding of the output HTML document
-
ToHTMLSAXHandler
Deprecated.A constructor.- Parameters:
handler- the wrapped SAX content handlerlex- the wrapped lexical handlerencoding- the encoding of the output HTML document
-
-
Method Details
-
getOutputFormat
Deprecated.Returns null.- Returns:
- null
- See Also:
-
getOutputStream
Deprecated.Reurns null- Returns:
- null
- See Also:
-
getWriter
Deprecated.Returns null- Returns:
- null
- See Also:
-
indent
Deprecated.Does nothing.- Throws:
SAXException
-
serialize
Deprecated.Does nothing.- Parameters:
node- the DOM node to be serialized.- Throws:
IOException- if an I/O exception occured while serializing- See Also:
-
setEscaping
Deprecated.Turns special character escaping on/off.- Parameters:
escape- true if escaping is to be set on.- Throws:
SAXException- See Also:
-
setIndent
public void setIndent(boolean indent) Deprecated.Does nothing- Overrides:
setIndentin classSerializerBase- Parameters:
indent- the number of spaces to indent per indentation level (ignored)- See Also:
-
XSLOutputAttributes.setIndent(boolean)
-
setOutputFormat
Deprecated.Does nothing.- Parameters:
format- this parameter is not used- See Also:
-
setOutputStream
Deprecated.Does nothing.- Parameters:
output- this parameter is ignored- See Also:
-
setWriter
Deprecated.Does nothing.- Parameters:
writer- this parameter is ignored.- See Also:
-
attributeDecl
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException Deprecated.Does nothing.- Parameters:
eName- this parameter is ignoredaName- this parameter is ignoredtype- this parameter is ignoredvalueDefault- this parameter is ignoredvalue- this parameter is ignored- Throws:
SAXException- See Also:
-
elementDecl
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
externalEntityDecl
Deprecated.- Throws:
SAXException- See Also:
-
internalEntityDecl
Deprecated.Does nothing. -
endElement
Deprecated.Receive notification of the end of an element.The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement() event for every endElement() event (even when the element is empty).
If the element name has a namespace prefix, the prefix will still be attached to the name.
- Parameters:
uri- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The qualified name (with prefix), or the empty string if qualified names are not available.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
endPrefixMapping
Deprecated.Does nothing.- Throws:
SAXException
-
ignorableWhitespace
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
processingInstruction
Deprecated.Receive notification of a processing instruction.The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classToSAXHandler- Parameters:
target- The processing instruction target.data- The processing instruction data, or null if none was supplied.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.SAXException- See Also:
-
setDocumentLocator
Deprecated.Does nothing.- 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.Does nothing.- Throws:
SAXException- See Also:
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException 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.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classToSAXHandler- Parameters:
namespaceURI- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The elements name.atts- The attributes attached to the element, if any.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.SAXException- See Also:
-
comment
Deprecated.Receive notification of a comment anywhere in the document. This callback will be used for comments inside or outside the document element.- Parameters:
ch- An array holding the characters in the comment.start- The starting position in the array.length- The number of characters to use from the array.- Throws:
SAXException- The application may raise an exception.- See Also:
-
endCDATA
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
endDTD
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
startCDATA
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
startEntity
Deprecated.Does nothing.- Throws:
SAXException- See Also:
-
endDocument
Deprecated.Receive notification of the end of a document.The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.SAXException
-
close
public void close()Deprecated.Do nothing.- Specified by:
closein interfaceSerializationHandler- Overrides:
closein classSerializerBase- See Also:
-
characters
Deprecated.Receive notification of character data.- Specified by:
charactersin interfaceExtendedContentHandler- Overrides:
charactersin classToSAXHandler- Parameters:
chars- The string of characters to process.- Throws:
SAXException- See Also:
-
startElement
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException Deprecated.An element starts, but attributes are not fully known yet.- 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.An 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:
-
endElement
Deprecated.Receive notification of the end of an element.- Parameters:
elementName- The element type name- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
-
characters
Deprecated.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:
ch- The characters from the XML document.off- The start position in the array.len- The number of characters to read from the array.- Throws:
SAXException- Any SAX exception, possibly wrapping another exception.SAXException- See Also:
-
flushPending
Deprecated.This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.- Specified by:
flushPendingin interfaceSerializationHandler- Overrides:
flushPendingin classToSAXHandler- Throws:
SAXException
-
startPrefixMapping
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException Deprecated.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.- Parameters:
prefix- The Namespace prefix being declared.uri- The Namespace URI the prefix is mapped to.shouldFlush- true if any open tags need to be closed first, this will impact which element the mapping applies to (open parent, or its up comming child)- Returns:
- returns true if the call made a change to the current namespace information, false if it did not change anything, e.g. if the prefix/namespace mapping was already in scope from before.
- Throws:
SAXException- The client may throw an exception during processing.- See Also:
-
startPrefixMapping
Deprecated.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.- Parameters:
prefix- The Namespace prefix being declared.uri- The Namespace URI the prefix is mapped to.- Throws:
SAXException- The client may throw an exception during processing.- See Also:
-
namespaceAfterStartElement
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(). startPrefixMapping(prefix,uri) would be used before the startElement() call.- Specified by:
namespaceAfterStartElementin interfaceExtendedContentHandler- Overrides:
namespaceAfterStartElementin classSerializerBase- Parameters:
prefix- the prefix associated with the given URI.uri- the URI of the namespace- Throws:
SAXException- See Also:
-
reset
public 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).- Specified by:
resetin interfaceSerializer- Overrides:
resetin classToSAXHandler- Returns:
- true if the class was successfuly reset.
- See Also:
-
ToXMLSAXHandler.