public class SaxSerializer extends Object implements XmlSerializer
| Constructor and Description |
|---|
SaxSerializer(ContentHandler handler) |
SaxSerializer(ContentHandler handler,
LexicalHandler lex)
Creates an
XmlSerializer that writes SAX events. |
SaxSerializer(ContentHandler handler,
LexicalHandler lex,
boolean indenting) |
SaxSerializer(SAXResult result) |
| Modifier and Type | Method and 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.
|
public SaxSerializer(ContentHandler handler)
public SaxSerializer(ContentHandler handler, LexicalHandler lex)
XmlSerializer that writes SAX events.
Sepcifying a non-null LexicalHandler allows applications
to write comments and CDATA sections.
public SaxSerializer(ContentHandler handler, LexicalHandler lex, boolean indenting)
public SaxSerializer(SAXResult result)
public void startDocument()
XmlSerializerstartDocument in interface XmlSerializerpublic void writeXmlns(String prefix, String uri)
XmlSerializerwriteXmlns in interface XmlSerializerprefix - 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.public void beginStartTag(String uri, String localName, String prefix)
XmlSerializerbeginStartTag in interface XmlSerializeruri - 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.public void writeAttribute(String uri, String localName, String prefix, StringBuilder value)
XmlSerializerwriteAttribute in interface XmlSerializeruri - 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.public void endStartTag(String uri, String localName, String prefix)
XmlSerializerendStartTag in interface XmlSerializeruri - 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.public void endTag()
XmlSerializerendTag in interface XmlSerializerpublic void text(StringBuilder text)
XmlSerializertext in interface XmlSerializertext - The character data to be written. It's the callee's responsibility to
escape special characters (such as <, >, and &) in this buffer.public void cdata(StringBuilder text)
XmlSerializercdata in interface XmlSerializerpublic void comment(StringBuilder comment)
XmlSerializercomment in interface XmlSerializerpublic void endDocument()
XmlSerializerendDocument in interface XmlSerializerpublic void flush()
XmlSerializerTypedXmlWriter.commit(boolean)
method. If the implementation performs any buffering, it should flush the buffer.flush in interface XmlSerializerCopyright © 2005–2017 Oracle Corporation. All rights reserved.