|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | 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
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.
Constructor Summary | |
ToHTMLSAXHandler(ContentHandler handler,
LexicalHandler lex,
java.lang.String encoding)
A constructor. |
|
ToHTMLSAXHandler(ContentHandler handler,
java.lang.String encoding)
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)
Does nothing. |
void |
characters(char[] ch,
int off,
int len)
Receive notification of character data. |
void |
characters(java.lang.String chars)
Receive notification of character data. |
void |
close()
Do nothing. |
void |
comment(char[] ch,
int start,
int length)
Receive notification of a comment anywhere in the document. |
void |
elementDecl(java.lang.String name,
java.lang.String model)
Does nothing. |
void |
endCDATA()
Does nothing. |
void |
endDocument()
Receive notification of the end of a document. |
void |
endDTD()
Does nothing. |
void |
endElement(java.lang.String elementName)
Receive notification of the end of an element. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Receive notification of the end of an element. |
void |
endPrefixMapping(java.lang.String prefix)
Does nothing. |
void |
externalEntityDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
|
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. |
java.util.Properties |
getOutputFormat()
Returns null. |
java.io.OutputStream |
getOutputStream()
Reurns null |
java.io.Writer |
getWriter()
Returns null |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Does nothing. |
void |
indent(int n)
Does nothing. |
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
Does nothing. |
void |
namespaceAfterStartElement(java.lang.String prefix,
java.lang.String uri)
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)
Receive notification of a processing instruction. |
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). |
void |
serialize(Node node)
Does nothing. |
void |
setDocumentLocator(Locator arg0)
Does nothing. |
boolean |
setEscaping(boolean escape)
Turns special character escaping on/off. |
void |
setIndent(boolean indent)
Does nothing |
void |
setOutputFormat(java.util.Properties format)
Does nothing. |
void |
setOutputStream(java.io.OutputStream output)
Does nothing. |
void |
setWriter(java.io.Writer writer)
Does nothing. |
void |
skippedEntity(java.lang.String arg0)
Does nothing. |
void |
startCDATA()
Does nothing. |
void |
startElement(java.lang.String elementName)
An element starts, but attributes are not fully known yet. |
void |
startElement(java.lang.String elementNamespaceURI,
java.lang.String elementLocalName,
java.lang.String elementName)
An element starts, but attributes are not fully known yet. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
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. |
void |
startEntity(java.lang.String arg0)
Does nothing. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
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)
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,
warning |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ToHTMLSAXHandler(ContentHandler handler, java.lang.String encoding)
handler
- the wrapped SAX content handlerencoding
- the encoding of the output HTML documentpublic ToHTMLSAXHandler(ContentHandler handler, 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 SAXException
public void serialize(Node node) throws java.io.IOException
DOMSerializer.serialize(Node)
public boolean setEscaping(boolean escape) throws SAXException
escape
- true if escaping is to be set on.SerializationHandler.setEscaping(boolean)
public void setIndent(boolean indent)
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 SAXException
eName
- this parameter is ignoredaName
- this parameter is ignoredtype
- this parameter is ignoredvalueDefault
- this parameter is ignoredvalue
- this parameter is ignoredDeclHandler.attributeDecl(String, String, String,String,String)
public void elementDecl(java.lang.String name, java.lang.String model) throws SAXException
DeclHandler.elementDecl(String, String)
public void externalEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
DeclHandler.externalEntityDecl(String, String, String)
public void internalEntityDecl(java.lang.String name, java.lang.String value) throws 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 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.ContentHandler.endElement(String, String, String)
public void endPrefixMapping(java.lang.String prefix) throws SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws 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.
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.ContentHandler.processingInstruction(String, String)
public void setDocumentLocator(Locator arg0)
ContentHandler.setDocumentLocator(Locator)
public void skippedEntity(java.lang.String arg0) throws SAXException
ContentHandler.skippedEntity(String)
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws SAXException
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.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 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.LexicalHandler.comment(char[], int, int)
public void endCDATA() throws SAXException
LexicalHandler.endCDATA()
public void endDTD() throws SAXException
LexicalHandler.endDTD()
public void startCDATA() throws SAXException
LexicalHandler.startCDATA()
public void startEntity(java.lang.String arg0) throws SAXException
LexicalHandler.startEntity(String)
public void endDocument() throws 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.
public void close()
SerializationHandler.close()
public void characters(java.lang.String chars) throws SAXException
chars
- The string of characters to process.ExtendedContentHandler.characters(String)
public void startElement(java.lang.String elementNamespaceURI, java.lang.String elementLocalName, java.lang.String elementName) throws SAXException
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)ExtendedContentHandler.startElement(String)
public void startElement(java.lang.String elementName) throws SAXException
elementName
- the element name, with prefix, if anyExtendedContentHandler.startElement(String)
public void endElement(java.lang.String elementName) throws SAXException
elementName
- The element type nameExtendedContentHandler.endElement(String)
public void characters(char[] ch, int off, int len) throws 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.ignorableWhitespace(char[], int, int)
,
Locator
,
ContentHandler.characters(char[], int, int)
public void flushPending() throws SAXException
public boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush) throws 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)ExtendedContentHandler.startPrefixMapping(java.lang.String, java.lang.String, boolean)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws SAXException
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri) throws SAXException
prefix
- the prefix associated with the given URI.uri
- the URI of the namespaceExtendedContentHandler.namespaceAfterStartElement(String, String)
public boolean reset()
Serializer.reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |