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.
attributeDecl
public void attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
Does nothing.
eName
- this parameter is ignoredaName
- this parameter is ignoredtype
- this parameter is ignoredvalueDefault
- this parameter is ignoredvalue
- this parameter is ignored
org.xml.sax.ext.DeclHandler.attributeDecl(String, String, String,String,String)
characters
public void characters(String chars)
throws SAXException
Receive notification of character data.
- characters in interface org.apache.xml.serializer.ExtendedContentHandler
- characters in interface ToSAXHandler
chars
- The string of characters to process.
ExtendedContentHandler.characters(String)
characters
public void characters(char[] ch,
int off,
int len)
throws SAXException
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).
ch
- The characters from the XML document.off
- The start position in the array.len
- The number of characters to read from the array.
comment
public void comment(char[] ch,
int start,
int length)
throws SAXException
Receive notification of a comment anywhere in the document. This callback
will be used for comments inside or outside the document element.
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.ext.LexicalHandler.comment(char[], int, int)
elementDecl
public void elementDecl(String name,
String model)
throws SAXException
Does nothing.
org.xml.sax.ext.DeclHandler.elementDecl(String, String)
endCDATA
public void endCDATA()
throws SAXException
Does nothing.
org.xml.sax.ext.LexicalHandler.endCDATA()
endDTD
public void endDTD()
throws SAXException
Does nothing.
org.xml.sax.ext.LexicalHandler.endDTD()
endDocument
public void endDocument()
throws SAXException
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.
endElement
public void endElement(String elementName)
throws SAXException
Receive notification of the end of an element.
- endElement in interface org.apache.xml.serializer.ExtendedContentHandler
elementName
- The element type name
ExtendedContentHandler.endElement(String)
endElement
public void endElement(String uri,
String localName,
String qName)
throws SAXException
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.
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.ContentHandler.endElement(String, String, String)
endPrefixMapping
public void endPrefixMapping(String prefix)
throws SAXException
Does nothing.
externalEntityDecl
public void externalEntityDecl(String arg0,
String arg1,
String arg2)
throws SAXException
org.xml.sax.ext.DeclHandler.externalEntityDecl(String, String, String)
flushPending
public void flushPending()
throws SAXException
This method flushes any pending events, which can be startDocument()
closing the opening tag of an element, or closing an open CDATA section.
- flushPending in interface SerializationHandler
- flushPending in interface ToSAXHandler
ignorableWhitespace
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
Does nothing.
org.xml.sax.ContentHandler.ignorableWhitespace(char[], int, int)
indent
public void indent(int n)
throws SAXException
Does nothing.
internalEntityDecl
public void internalEntityDecl(String name,
String value)
throws SAXException
Does nothing.
org.xml.sax.DTDHandler.unparsedEntityDecl
namespaceAfterStartElement
public void namespaceAfterStartElement(String prefix,
String uri)
throws SAXException
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.
- namespaceAfterStartElement in interface org.apache.xml.serializer.ExtendedContentHandler
- namespaceAfterStartElement in interface SerializerBase
prefix
- the prefix associated with the given URI.uri
- the URI of the namespace
ExtendedContentHandler.namespaceAfterStartElement(String, String)
processingInstruction
public void processingInstruction(String target,
String data)
throws SAXException
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.
- processingInstruction in interface ToSAXHandler
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.
org.xml.sax.ContentHandler.processingInstruction(String, String)
reset
public 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).
- reset in interface Serializer
- reset in interface ToSAXHandler
- true if the class was successfuly reset.
setDocumentLocator
public void setDocumentLocator(Locator arg0)
Does nothing.
- setDocumentLocator in interface SerializerBase
org.xml.sax.ContentHandler.setDocumentLocator(Locator)
setEscaping
public boolean setEscaping(boolean escape)
throws SAXException
Turns special character escaping on/off.
- setEscaping in interface SerializationHandler
escape
- true if escaping is to be set on.
setIndent
public void setIndent(boolean indent)
Does nothing
- setIndent in interface org.apache.xml.serializer.XSLOutputAttributes
- setIndent in interface SerializerBase
indent
- the number of spaces to indent per indentation level
(ignored)
SerializationHandler.setIndent(boolean)
setOutputFormat
public void setOutputFormat(Properties format)
Does nothing.
- setOutputFormat in interface Serializer
format
- this parameter is not used
setOutputStream
public void setOutputStream(OutputStream output)
Does nothing.
- setOutputStream in interface Serializer
output
- this parameter is ignored
setWriter
public void setWriter(Writer writer)
Does nothing.
- setWriter in interface Serializer
writer
- this parameter is ignored.
skippedEntity
public void skippedEntity(String arg0)
throws SAXException
Does nothing.
org.xml.sax.ContentHandler.skippedEntity(String)
startCDATA
public void startCDATA()
throws SAXException
Does nothing.
org.xml.sax.ext.LexicalHandler.startCDATA()
startElement
public void startElement(String elementName)
throws SAXException
An element starts, but attributes are not fully known yet.
- startElement in interface org.apache.xml.serializer.ExtendedContentHandler
- startElement in interface ToSAXHandler
elementName
- the element name, with prefix, if any
ExtendedContentHandler.startElement(String)
startElement
public void startElement(String elementNamespaceURI,
String elementLocalName,
String elementName)
throws SAXException
An element starts, but attributes are not fully known yet.
- startElement in interface org.apache.xml.serializer.ExtendedContentHandler
- startElement in interface 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)
ExtendedContentHandler.startElement(String)
startElement
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
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.
- startElement in interface 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.ContentHandler.startElement
, org.xml.sax.ContentHandler.endElement
, org.xml.sax.AttributeList
, org.xml.sax.ContentHandler.startElement(String, String, String, Attributes)
startEntity
public void startEntity(String arg0)
throws SAXException
Does nothing.
org.xml.sax.ext.LexicalHandler.startEntity(String)
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
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.
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.ContentHandler.startPrefixMapping
startPrefixMapping
public boolean startPrefixMapping(String prefix,
String uri,
boolean shouldFlush)
throws SAXException
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.
- startPrefixMapping in interface org.apache.xml.serializer.ExtendedContentHandler
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 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.
ExtendedContentHandler.startPrefixMapping