|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.serializer.SerializerBase org.apache.xml.serializer.ToSAXHandler org.apache.xml.serializer.ToHTMLSAXHandler
ToXMLSAXHandler
.
public final class ToHTMLSAXHandler
This class accepts SAX-like calls, then sends true SAX calls to a wrapped SAX handler. There is optimization done knowing that the ultimate output is HTML. This class is not a public API.
Field Summary | |
---|---|
private boolean |
m_dtdHandled
Deprecated. Handle document type declaration (for first element only) |
protected boolean |
m_escapeSetting
Deprecated. Keeps track of whether output escaping is currently enabled |
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 | |
---|---|
ToHTMLSAXHandler(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lex,
java.lang.String encoding)
Deprecated. A constructor. |
|
ToHTMLSAXHandler(org.xml.sax.ContentHandler handler,
java.lang.String encoding)
Deprecated. A constructor |
Method Summary | |
---|---|
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
Deprecated. Does nothing. |
void |
characters(char[] ch,
int off,
int len)
Deprecated. Receive notification of character data. |
void |
characters(java.lang.String chars)
Deprecated. Receive notification of character data. |
void |
close()
Deprecated. Do nothing. |
protected void |
closeStartTag()
Deprecated. This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered. |
void |
comment(char[] ch,
int start,
int length)
Deprecated. Receive notification of a comment anywhere in the document. |
void |
elementDecl(java.lang.String name,
java.lang.String model)
Deprecated. Does nothing. |
void |
endCDATA()
Deprecated. Does nothing. |
void |
endDocument()
Deprecated. Receive notification of the end of a document. |
void |
endDTD()
Deprecated. Does nothing. |
void |
endElement(java.lang.String elementName)
Deprecated. Receive notification of the end of an element. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Deprecated. Receive notification of the end of an element. |
void |
endPrefixMapping(java.lang.String prefix)
Deprecated. Does nothing. |
void |
externalEntityDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
Deprecated. |
void |
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. |
java.util.Properties |
getOutputFormat()
Deprecated. Returns null. |
java.io.OutputStream |
getOutputStream()
Deprecated. Reurns null |
java.io.Writer |
getWriter()
Deprecated. Returns null |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Deprecated. Does nothing. |
void |
indent(int n)
Deprecated. Does nothing. |
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
Deprecated. Does nothing. |
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 target,
java.lang.String data)
Deprecated. Receive notification of a processing instruction. |
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). |
private void |
resetToHTMLSAXHandler()
Deprecated. Reset all of the fields owned by ToHTMLSAXHandler class |
void |
serialize(org.w3c.dom.Node node)
Deprecated. Does nothing. |
void |
setDocumentLocator(org.xml.sax.Locator arg0)
Deprecated. Does nothing. |
boolean |
setEscaping(boolean escape)
Deprecated. Turns special character escaping on/off. |
void |
setIndent(boolean indent)
Deprecated. Does nothing |
void |
setOutputFormat(java.util.Properties format)
Deprecated. Does nothing. |
void |
setOutputStream(java.io.OutputStream output)
Deprecated. Does nothing. |
void |
setWriter(java.io.Writer writer)
Deprecated. Does nothing. |
void |
skippedEntity(java.lang.String arg0)
Deprecated. Does nothing. |
void |
startCDATA()
Deprecated. Does nothing. |
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. An element starts, but attributes are not fully known yet. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.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. |
void |
startEntity(java.lang.String arg0)
Deprecated. Does nothing. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Deprecated. Begin the scope of a prefix-URI Namespace mapping just before another element is about to start. |
boolean |
startPrefixMapping(java.lang.String prefix,
java.lang.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, closeCDATA, comment, error, fatalError, getShouldOutputNSAttr, setCdataSectionElements, setContentHandler, setLexHandler, setShouldOutputNSAttr, setTransformState, startDocumentInternal, startDTD, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean m_dtdHandled
protected boolean m_escapeSetting
Constructor Detail |
---|
public ToHTMLSAXHandler(org.xml.sax.ContentHandler handler, java.lang.String encoding)
handler
- the wrapped SAX content handlerencoding
- the encoding of the output HTML documentpublic ToHTMLSAXHandler(org.xml.sax.ContentHandler handler, org.xml.sax.ext.LexicalHandler lex, java.lang.String encoding)
handler
- the wrapped SAX content handlerlex
- the wrapped lexical handlerencoding
- the encoding of the output HTML documentMethod Detail |
---|
public java.util.Properties getOutputFormat()
Serializer.getOutputFormat()
public java.io.OutputStream getOutputStream()
Serializer.getOutputStream()
public java.io.Writer getWriter()
Serializer.getWriter()
public void indent(int n) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void serialize(org.w3c.dom.Node node) throws java.io.IOException
node
- the DOM node to serialize
java.io.IOException
- if an I/O exception occured while serializingDOMSerializer.serialize(Node)
public boolean setEscaping(boolean escape) throws org.xml.sax.SAXException
escape
- true if escaping is to be set on.
org.xml.sax.SAXException
SerializationHandler.setEscaping(boolean)
public void setIndent(boolean indent)
setIndent
in interface XSLOutputAttributes
setIndent
in class SerializerBase
indent
- the number of spaces to indent per indentation level
(ignored)XSLOutputAttributes.setIndent(boolean)
public void setOutputFormat(java.util.Properties format)
format
- this parameter is not usedSerializer.setOutputFormat(Properties)
public void setOutputStream(java.io.OutputStream output)
output
- this parameter is ignoredSerializer.setOutputStream(OutputStream)
public void setWriter(java.io.Writer writer)
writer
- this parameter is ignored.Serializer.setWriter(Writer)
public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value) throws org.xml.sax.SAXException
eName
- this parameter is ignoredaName
- this parameter is ignoredtype
- this parameter is ignoredvalueDefault
- this parameter is ignoredvalue
- this parameter is ignored
org.xml.sax.SAXException
DeclHandler.attributeDecl(String, String, String,String,String)
public void elementDecl(java.lang.String name, java.lang.String model) throws org.xml.sax.SAXException
org.xml.sax.SAXException
DeclHandler.elementDecl(String, String)
public void externalEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws org.xml.sax.SAXException
org.xml.sax.SAXException
DeclHandler.externalEntityDecl(String, String, String)
public void internalEntityDecl(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
org.xml.sax.SAXException
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
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.
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(String, String, String)
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
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.
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class ToSAXHandler
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
ContentHandler.processingInstruction(String, String)
public void setDocumentLocator(org.xml.sax.Locator arg0)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class SerializerBase
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.
ContentHandler.setDocumentLocator(Locator)
public void skippedEntity(java.lang.String arg0) throws org.xml.sax.SAXException
org.xml.sax.SAXException
ContentHandler.skippedEntity(String)
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class ToSAXHandler
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
,
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
,
ContentHandler.startElement(String, String, String, Attributes)
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
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.
org.xml.sax.SAXException
- The application may raise an exception.LexicalHandler.comment(char[], int, int)
public void endCDATA() throws org.xml.sax.SAXException
org.xml.sax.SAXException
LexicalHandler.endCDATA()
public void endDTD() throws org.xml.sax.SAXException
org.xml.sax.SAXException
LexicalHandler.endDTD()
public void startCDATA() throws org.xml.sax.SAXException
org.xml.sax.SAXException
LexicalHandler.startCDATA()
public void startEntity(java.lang.String arg0) throws org.xml.sax.SAXException
org.xml.sax.SAXException
LexicalHandler.startEntity(String)
public void endDocument() throws org.xml.sax.SAXException
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
protected void closeStartTag() throws org.xml.sax.SAXException
closeStartTag
in class ToSAXHandler
org.xml.sax.SAXException
public void close()
close
in interface SerializationHandler
close
in class SerializerBase
SerializationHandler.close()
public void characters(java.lang.String chars) throws org.xml.sax.SAXException
characters
in interface ExtendedContentHandler
characters
in class ToSAXHandler
chars
- The string of characters to process.
org.xml.sax.SAXException
ExtendedContentHandler.characters(String)
public void startElement(java.lang.String elementNamespaceURI, java.lang.String elementLocalName, java.lang.String elementName) throws org.xml.sax.SAXException
startElement
in interface ExtendedContentHandler
startElement
in class ToSAXHandler
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)
org.xml.sax.SAXException
ExtendedContentHandler.startElement(String)
public void startElement(java.lang.String elementName) throws org.xml.sax.SAXException
startElement
in interface ExtendedContentHandler
startElement
in class ToSAXHandler
elementName
- the element name, with prefix, if any
org.xml.sax.SAXException
ExtendedContentHandler.startElement(String)
public void endElement(java.lang.String elementName) throws org.xml.sax.SAXException
elementName
- The element type name
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ExtendedContentHandler.endElement(String)
public void characters(char[] ch, int off, int len) throws org.xml.sax.SAXException
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).
ch
- The characters from the XML document.off
- The start position in the array.len
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
ignorableWhitespace(char[], int, int)
,
Locator
,
ContentHandler.characters(char[], int, int)
public void flushPending() throws org.xml.sax.SAXException
flushPending
in interface SerializationHandler
flushPending
in class ToSAXHandler
org.xml.sax.SAXException
public boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush) throws org.xml.sax.SAXException
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)
org.xml.sax.SAXException
- The client may throw
an exception during processing.ExtendedContentHandler.startPrefixMapping(java.lang.String, java.lang.String, boolean)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
namespaceAfterStartElement
in interface ExtendedContentHandler
namespaceAfterStartElement
in class SerializerBase
prefix
- the prefix associated with the given URI.uri
- the URI of the namespace
org.xml.sax.SAXException
ExtendedContentHandler.namespaceAfterStartElement(String, String)
public boolean reset()
reset
in interface Serializer
reset
in class ToSAXHandler
Serializer.reset()
private void resetToHTMLSAXHandler()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |