| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultSaxWriter.StringAttributes
List of SAX attributes based upon a string array.
|
| Constructor and Description |
|---|
DefaultSaxWriter(OutputStream stream)
Creates a DefaultSaxWriter writing to an
OutputStream. |
DefaultSaxWriter(OutputStream stream,
String xmlEncoding) |
DefaultSaxWriter(PrintWriter writer,
int initialIndent)
Creates a DefaultSaxWriter writing to a
PrintWriter. |
DefaultSaxWriter(Writer writer)
Creates a
SAXWriter writing to a Writer. |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(String s) |
void |
completeBeforeElement(String tagName) |
void |
element(String tagName,
Object... attributes) |
void |
endDocument() |
void |
endElement() |
void |
endSequence()
Informs the writer that a sequence of elements of the same name has
ended.
|
void |
flush()
Flushes any unwritten output.
|
void |
startDocument() |
void |
startElement(String tagName) |
void |
startElement(String tagName,
Object... attributes) |
void |
startSequence(String name,
String subName)
Informs the writer that a sequence of elements of the same name is
starting.
|
void |
textElement(String name,
Object data)
Generates a text-only element,
<name>data</name>. |
void |
verbatim(String text)
Sends a piece of text verbatim through the writer.
|
public DefaultSaxWriter(OutputStream stream)
OutputStream.public DefaultSaxWriter(OutputStream stream, String xmlEncoding) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic DefaultSaxWriter(Writer writer)
SAXWriter writing to a Writer.
If writer is a PrintWriter,
DefaultSaxWriter(java.io.OutputStream) is preferred.
public DefaultSaxWriter(PrintWriter writer, int initialIndent)
PrintWriter.writer - WriterinitialIndent - Initial indentpublic void characters(String s)
characters in interface SaxWriterpublic void startSequence(String name, String subName)
SaxWriterFor XML, is equivalent to startElement(name).
For JSON, initiates the array construct:
"name" : [
{ ... },
{ ... }
]startSequence in interface SaxWritername - Element namesubName - Child element namepublic void endSequence()
SaxWriterendSequence in interface SaxWriterpublic final void textElement(String name, Object data)
SaxWriter<name>data</name>.
For XML, this is equivalent to
startElement(name);
characters(data);
endElement();
but for JSON, generates "name": "data".textElement in interface SaxWritername - Name of elementdata - Text content of elementpublic void startElement(String tagName)
startElement in interface SaxWriterpublic void startElement(String tagName, Object... attributes)
startElement in interface SaxWriterpublic void endElement()
endElement in interface SaxWriterpublic void startDocument()
startDocument in interface SaxWriterpublic void endDocument()
endDocument in interface SaxWriterpublic void completeBeforeElement(String tagName)
completeBeforeElement in interface SaxWriterpublic void verbatim(String text)
SaxWriterCopyright © 2021 Hitachi Vantara. All rights reserved.