Package com.badlogic.gdx.utils
Class XmlWriter
- java.lang.Object
-
- java.io.Writer
-
- com.badlogic.gdx.utils.XmlWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class XmlWriter extends java.io.WriterBuilder style API for emitting XML.StringWriter writer = new StringWriter(); XmlWriter xml = new XmlWriter(writer); xml.element("meow") .attribute("moo", "cow") .element("child") .attribute("moo", "cow") .element("child") .attribute("moo", "cow") .text("XML is like violence. If it doesn't solve your problem, you're not using enough of it.") .pop() .pop() .pop(); System.out.println(writer);
-
-
Field Summary
Fields Modifier and Type Field Description intindent
-
Constructor Summary
Constructors Constructor Description XmlWriter(java.io.Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlWriterattribute(java.lang.String name, java.lang.Object value)voidclose()Callspop()for each remaining open element, if any, and closes the stream.XmlWriterelement(java.lang.String name)XmlWriterelement(java.lang.String name, java.lang.Object text)voidflush()XmlWriterpop()XmlWritertext(java.lang.Object text)voidwrite(char[] cbuf, int off, int len)
-
-
-
Method Detail
-
element
public XmlWriter element(java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
element
public XmlWriter element(java.lang.String name, java.lang.Object text) throws java.io.IOException
- Throws:
java.io.IOException
-
attribute
public XmlWriter attribute(java.lang.String name, java.lang.Object value) throws java.io.IOException
- Throws:
java.io.IOException
-
text
public XmlWriter text(java.lang.Object text) throws java.io.IOException
- Throws:
java.io.IOException
-
pop
public XmlWriter pop() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCallspop()for each remaining open element, if any, and closes the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
-