Class XmlWriter
- java.lang.Object
-
- org.astrogrid.samp.xmlrpc.internal.XmlWriter
-
class XmlWriter extends java.lang.ObjectUtility class for writing XML.- Since:
- 26 Aug 2008
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description XmlWriter(java.io.OutputStream out, int indent)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream.voidend(java.lang.String element)End an element.voidinline(java.lang.String element, java.lang.String content)Write an element and its text content.voidliteral(java.lang.String txt)Writes text with no escaping of XML special characters etc.voidnewline()Writes a new line character.private voidpad(int level)Outputs start-of-line padding for a given level of indentation.voidsampValue(java.lang.Object value)Writes a SAMP-friendly object in XML-RPC form.voidstart(java.lang.String element)Start an element.voidtext(java.lang.String txt)Writes text.
-
-
-
Field Detail
-
out_
private final java.io.Writer out_
-
indent_
private final int indent_
-
iLevel_
private int iLevel_
-
ENCODING
private static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public void start(java.lang.String element) throws java.io.IOExceptionStart an element.- Parameters:
element- tag name- Throws:
java.io.IOException
-
end
public void end(java.lang.String element) throws java.io.IOExceptionEnd an element.- Parameters:
element- tag name- Throws:
java.io.IOException
-
inline
public void inline(java.lang.String element, java.lang.String content) throws java.io.IOExceptionWrite an element and its text content.- Parameters:
element- tag namecontent- element text content- Throws:
java.io.IOException
-
text
public void text(java.lang.String txt) throws java.io.IOExceptionWrites text. Any escaping required for XML output will be taken care of.- Parameters:
txt- text to output- Throws:
java.io.IOException
-
literal
public void literal(java.lang.String txt) throws java.io.IOExceptionWrites text with no escaping of XML special characters etc.- Parameters:
txt- raw text to output- Throws:
java.io.IOException
-
newline
public void newline() throws java.io.IOExceptionWrites a new line character.- Throws:
java.io.IOException
-
sampValue
public void sampValue(java.lang.Object value) throws java.io.IOExceptionWrites a SAMP-friendly object in XML-RPC form.- Parameters:
value- object to serialize; must be a string, list or map- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the stream.- Throws:
java.io.IOException
-
pad
private void pad(int level) throws java.io.IOExceptionOutputs start-of-line padding for a given level of indentation.- Parameters:
level- level of XML element ancestry- Throws:
java.io.IOException
-
-