public class SimpleXmlOutputter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SimpleXmlOutputter.ModeBits |
Modifier and Type | Field and Description |
---|---|
(package private) int |
mode |
(package private) java.lang.String |
newline |
(package private) java.lang.String |
sIdent |
static int |
version
Version, history and license.
|
Constructor and Description |
---|
SimpleXmlOutputter() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
attribute(java.lang.String name,
java.lang.String value) |
private static void |
convert(java.lang.StringBuilder[] buffer,
java.lang.String[] text,
int pos1,
char cc,
java.lang.String sNew) |
static java.lang.CharSequence |
convertString(java.lang.String textP)
Replaces XML special character.
|
static java.lang.String |
elementEnd(java.lang.String name) |
static java.lang.String |
elementShortEnd() |
static java.lang.String |
elementStart(java.lang.String name) |
static java.lang.String |
elementTagEnd() |
void |
write(java.io.OutputStreamWriter out,
XmlNode xmlNode)
Writes the XML tree into a byte stream and closes after them.
|
void |
write(java.io.Writer out,
java.lang.CharSequence sEncoding,
XmlNode xmlNode)
Writes the XML tree into a character stream and closes after them.
|
protected void |
writeNode(java.io.Writer out,
XmlNode xmlNode,
int nIndent) |
public static final int version
write(Writer, CharSequence, XmlNode)
especially for test outputs
which should stored only locally without a File using.
BufferedWriter
internally. The BufferedWriter.newLine()
is not invoked therefore the platform depending line separator is not used. The line separator is still
a simple '\n'. But the output may be faster, or not because the Writer outside may have a buffer too.
That BufferedWriter is included as debug helper primary. The output String should be seen.
Some comments and test features added.
convertString(String)
is now public.
int mode
java.lang.String newline
java.lang.String sIdent
public void write(java.io.OutputStreamWriter out, XmlNode xmlNode) throws java.io.IOException
out
- A Writer to convert in a Byte stream.xmlNode
- The top level nodejava.io.IOException
public void write(java.io.Writer out, java.lang.CharSequence sEncoding, XmlNode xmlNode) throws java.io.IOException
out
- A Writer better for String output in comparison to the Stream (byte, encoded) output.sEncoding
- the encoding String stored in the XML file. Note: It should be matching to the Writer.xmlNode
- The top level nodejava.io.IOException
protected void writeNode(java.io.Writer out, XmlNode xmlNode, int nIndent) throws java.io.IOException
java.io.IOException
public static java.lang.String elementStart(java.lang.String name)
public static java.lang.String elementTagEnd()
public static java.lang.String elementShortEnd()
public static java.lang.String elementEnd(java.lang.String name)
public static java.lang.String attribute(java.lang.String name, java.lang.String value)
public static java.lang.CharSequence convertString(java.lang.String textP)
textP
- private static void convert(java.lang.StringBuilder[] buffer, java.lang.String[] text, int pos1, char cc, java.lang.String sNew)