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
UnsupportedEncodingException
public 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 SaxWriter
public void startSequence(String name, String subName)
SaxWriter
For XML, is equivalent to startElement(name)
.
For JSON, initiates the array construct:
"name" : [
{ ... },
{ ... }
]
startSequence
in interface SaxWriter
name
- Element namesubName
- Child element namepublic void endSequence()
SaxWriter
endSequence
in interface SaxWriter
public 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 SaxWriter
name
- Name of elementdata
- Text content of elementpublic void startElement(String tagName)
startElement
in interface SaxWriter
public void startElement(String tagName, Object... attributes)
startElement
in interface SaxWriter
public void endElement()
endElement
in interface SaxWriter
public void startDocument()
startDocument
in interface SaxWriter
public void endDocument()
endDocument
in interface SaxWriter
public void completeBeforeElement(String tagName)
completeBeforeElement
in interface SaxWriter
public void verbatim(String text)
SaxWriter
Copyright © 2018 Hitachi Vantara. All rights reserved.