Package com.sun.xml.txw2.output
Class SaxSerializer
- java.lang.Object
-
- com.sun.xml.txw2.output.SaxSerializer
-
- All Implemented Interfaces:
XmlSerializer
public class SaxSerializer extends Object implements XmlSerializer
- Author:
- [email protected]
-
-
Constructor Summary
Constructors Constructor Description SaxSerializer(SAXResult result)
SaxSerializer(ContentHandler handler)
SaxSerializer(ContentHandler handler, LexicalHandler lex)
Creates anXmlSerializer
that writes SAX events.SaxSerializer(ContentHandler handler, LexicalHandler lex, boolean indenting)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginStartTag(String uri, String localName, String prefix)
Begins writing a start tag.void
cdata(StringBuilder text)
Writes CDATA.void
comment(StringBuilder comment)
Writes a comment.void
endDocument()
The last method to be called.void
endStartTag(String uri, String localName, String prefix)
Completes the start tag.void
endTag()
Writes an end tag.void
flush()
Flush the buffer.void
startDocument()
The first method to be called.void
text(StringBuilder text)
Writes PCDATA.void
writeAttribute(String uri, String localName, String prefix, StringBuilder value)
Writes an attribute.void
writeXmlns(String prefix, String uri)
Writes a namespace declaration.
-
-
-
Constructor Detail
-
SaxSerializer
public SaxSerializer(ContentHandler handler)
-
SaxSerializer
public SaxSerializer(ContentHandler handler, LexicalHandler lex)
Creates anXmlSerializer
that writes SAX events.Sepcifying a non-null
LexicalHandler
allows applications to write comments and CDATA sections.
-
SaxSerializer
public SaxSerializer(ContentHandler handler, LexicalHandler lex, boolean indenting)
-
SaxSerializer
public SaxSerializer(SAXResult result)
-
-
Method Detail
-
startDocument
public void startDocument()
Description copied from interface:XmlSerializer
The first method to be called.- Specified by:
startDocument
in interfaceXmlSerializer
-
writeXmlns
public void writeXmlns(String prefix, String uri)
Description copied from interface:XmlSerializer
Writes a namespace declaration.- Specified by:
writeXmlns
in interfaceXmlSerializer
- Parameters:
prefix
- the prefix that is allocated. Can be empty but never be null.uri
- the namespace URI to be declared. Can be empty but never be null.
-
beginStartTag
public void beginStartTag(String uri, String localName, String prefix)
Description copied from interface:XmlSerializer
Begins writing a start tag.- Specified by:
beginStartTag
in interfaceXmlSerializer
- Parameters:
uri
- the namespace URI of the element. Can be empty but never be null.prefix
- the prefix that should be used for this element. Can be empty, but never null.
-
writeAttribute
public void writeAttribute(String uri, String localName, String prefix, StringBuilder value)
Description copied from interface:XmlSerializer
Writes an attribute.- Specified by:
writeAttribute
in interfaceXmlSerializer
- Parameters:
uri
- the namespace URI of the attribute. Can be empty but never be null.prefix
- the prefix that should be used for this attribute. Can be empty, but never null.value
- The value of the attribute. It's the callee's responsibility to escape special characters (such as <, >, and &) in this buffer.
-
endStartTag
public void endStartTag(String uri, String localName, String prefix)
Description copied from interface:XmlSerializer
Completes the start tag.- Specified by:
endStartTag
in interfaceXmlSerializer
- Parameters:
uri
- the namespace URI of the element. Can be empty but never be null.prefix
- the prefix that should be used for this element. Can be empty, but never null.
-
endTag
public void endTag()
Description copied from interface:XmlSerializer
Writes an end tag.- Specified by:
endTag
in interfaceXmlSerializer
-
text
public void text(StringBuilder text)
Description copied from interface:XmlSerializer
Writes PCDATA.- Specified by:
text
in interfaceXmlSerializer
- Parameters:
text
- The character data to be written. It's the callee's responsibility to escape special characters (such as <, >, and &) in this buffer.
-
cdata
public void cdata(StringBuilder text)
Description copied from interface:XmlSerializer
Writes CDATA.- Specified by:
cdata
in interfaceXmlSerializer
-
comment
public void comment(StringBuilder comment)
Description copied from interface:XmlSerializer
Writes a comment.- Specified by:
comment
in interfaceXmlSerializer
-
endDocument
public void endDocument()
Description copied from interface:XmlSerializer
The last method to be called.- Specified by:
endDocument
in interfaceXmlSerializer
-
flush
public void flush()
Description copied from interface:XmlSerializer
Flush the buffer. This method is called when applications invokeTypedXmlWriter.commit(boolean)
method. If the implementation performs any buffering, it should flush the buffer.- Specified by:
flush
in interfaceXmlSerializer
-
-