class XmlWriter
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
ENCODING |
private int |
iLevel_ |
private int |
indent_ |
private java.io.Writer |
out_ |
| Constructor and Description |
|---|
XmlWriter(java.io.OutputStream out,
int indent)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream.
|
void |
end(java.lang.String element)
End an element.
|
void |
inline(java.lang.String element,
java.lang.String content)
Write an element and its text content.
|
void |
literal(java.lang.String txt)
Writes text with no escaping of XML special characters etc.
|
void |
newline()
Writes a new line character.
|
private void |
pad(int level)
Outputs start-of-line padding for a given level of indentation.
|
void |
sampValue(java.lang.Object value)
Writes a SAMP-friendly object in XML-RPC form.
|
void |
start(java.lang.String element)
Start an element.
|
void |
text(java.lang.String txt)
Writes text.
|
private final java.io.Writer out_
private final int indent_
private int iLevel_
private static final java.lang.String ENCODING
public XmlWriter(java.io.OutputStream out,
int indent)
throws java.io.IOException
out - destination streamindent - number of spaces to indent each element leveljava.io.IOExceptionpublic void start(java.lang.String element)
throws java.io.IOException
element - tag namejava.io.IOExceptionpublic void end(java.lang.String element)
throws java.io.IOException
element - tag namejava.io.IOExceptionpublic void inline(java.lang.String element,
java.lang.String content)
throws java.io.IOException
element - tag namecontent - element text contentjava.io.IOExceptionpublic void text(java.lang.String txt)
throws java.io.IOException
txt - text to outputjava.io.IOExceptionpublic void literal(java.lang.String txt)
throws java.io.IOException
txt - raw text to outputjava.io.IOExceptionpublic void newline()
throws java.io.IOException
java.io.IOExceptionpublic void sampValue(java.lang.Object value)
throws java.io.IOException
value - object to serialize; must be a string, list or mapjava.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOExceptionprivate void pad(int level)
throws java.io.IOException
level - level of XML element ancestryjava.io.IOException