org.apache.xml.serialize
Class TextSerializer
- ContentHandler, DeclHandler, DocumentHandler, DTDHandler, LexicalHandler, DOMSerializer, Serializer
public class TextSerializer
Implements a text serializer supporting both DOM and SAX
serializing. For usage instructions see
Serializer
.
If an output stream is used, the encoding is taken from the
output format (defaults to
UTF-8). If a writer is
used, make sure the writer uses the same encoding (if applies)
as specified in the output format.
The serializer supports both DOM and SAX. DOM serializing is done
by calling
TextSerializer
and SAX serializing is done by firing
SAX events and using the serializer as a document handler.
If an I/O exception occurs while serializing, the serializer
will not throw an exception directly, but only throw it
at the end of serializing (either DOM or SAX's
org.xml.sax.DocumentHandler.endDocument
.
$Revision: 1.14 $ $Date: 2004/02/24 23:34:03 $
_docTypePublicId , _docTypeSystemId , _encodingInfo , _format , _indenting , _prefixes , _printer , _started , fCurrentNode , fDOMError , fDOMErrorHandler , fDOMFilter , fStrBuffer , features |
protected void | characters(String text, boolean unescaped)
|
void | characters(char[] chars, int start, int length)
|
void | comment(String text)
|
void | comment(char[] chars, int start, int length)
|
protected ElementState | content()
|
void | endElement(String tagName)
|
void | endElement(String namespaceURI, String localName, String rawName)
|
void | endElementIO(String tagName)
|
protected String | getEntityRef(int ch)
|
void | processingInstructionIO(String target, String code)
|
protected void | serializeElement(Element elem) - Called to serialize a DOM element.
|
protected void | serializeNode(Node node) - Serialize the DOM node.
|
void | setOutputFormat(OutputFormat format)
|
protected void | startDocument(String rootTagName) - Called to serialize the document's DOCTYPE by the root element.
|
void | startElement(String tagName, AttributeList attrs)
|
void | startElement(String namespaceURI, String localName, String rawName, Attributes attrs)
|
asContentHandler , asDOMSerializer , asDocumentHandler , attributeDecl , characters , characters , checkUnboundNamespacePrefixedNode , comment , comment , content , elementDecl , endCDATA , endDTD , endDocument , endEntity , endNonEscaping , endPrefixMapping , endPreserving , enterElementState , externalEntityDecl , fatalError , getElementState , getEntityRef , getPrefix , ignorableWhitespace , internalEntityDecl , isDocumentState , leaveElementState , modifyDOMError , notationDecl , prepare , printCDATAText , printDoctypeURL , printEscaped , printEscaped , printText , printText , processingInstruction , processingInstructionIO , reset , serialize , serialize , serialize , serializeElement , serializeNode , serializePreRoot , setDocumentLocator , setOutputByteStream , setOutputCharStream , setOutputFormat , skippedEntity , startCDATA , startDTD , startDocument , startEntity , startNonEscaping , startPrefixMapping , startPreserving , surrogates , unparsedEntityDecl |
TextSerializer
public TextSerializer()
Constructs a new serializer. The serializer cannot be used without
calling TextSerializer
or TextSerializer
first.
characters
protected void characters(String text,
boolean unescaped)
throws IOException
endElement
public void endElement(String tagName)
throws SAXException
endElement
public void endElement(String namespaceURI,
String localName,
String rawName)
throws SAXException
endElementIO
public void endElementIO(String tagName)
throws IOException
serializeElement
protected void serializeElement(Element elem)
throws IOException
Called to serialize a DOM element. Equivalent to calling startElement
, endElement
and serializing everything
inbetween, but better optimized.
- serializeElement in interface BaseMarkupSerializer
serializeNode
protected void serializeNode(Node node)
throws IOException
Serialize the DOM node. This method is unique to the Text serializer.
- serializeNode in interface BaseMarkupSerializer
node
- The node to serialize
startDocument
protected void startDocument(String rootTagName)
throws IOException
Called to serialize the document's DOCTYPE by the root element.
This method will check if it has not been called before (
BaseMarkupSerializer._started
),
will serialize the document type declaration, and will serialize all
pre-root comments and PIs that were accumulated in the document
(see
TextSerializer
). Pre-root will be serialized even if
this is not the first root element of the document.
startElement
public void startElement(String tagName,
AttributeList attrs)
throws SAXException
startElement
public void startElement(String namespaceURI,
String localName,
String rawName,
Attributes attrs)
throws SAXException
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.