org.apache.xml.serialize
public class TextSerializer extends BaseMarkupSerializer
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 {@link #serialize} 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 {@link org.xml.sax.DocumentHandler#endDocument}.
Version: $Revision: 1.14 $ $Date: 2004/02/24 23:34:03 $
See Also: Serializer
Constructor Summary | |
---|---|
TextSerializer()
Constructs a new serializer. |
Method Summary | |
---|---|
void | characters(char[] chars, int start, int length) |
protected void | characters(String text, boolean unescaped) |
void | comment(String text) |
void | comment(char[] chars, int start, int length) |
protected ElementState | content() |
void | endElement(String namespaceURI, String localName, String rawName) |
void | endElement(String tagName) |
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 namespaceURI, String localName, String rawName, Attributes attrs) |
void | startElement(String tagName, AttributeList attrs) |
Parameters: node The node to serialize
This method will check if it has not been called before ({@link #_started}), will serialize the document type declaration, and will serialize all pre-root comments and PIs that were accumulated in the document (see {@link #serializePreRoot}). Pre-root will be serialized even if this is not the first root element of the document.