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
public class XmlWriter
- extends java.io.Writer
Builder style API for emitting XML.
StringWriter writer = new StringWriter();
XmlBuilder xml = new XmlBuilder(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);
- Author:
- Nathan Sweet
Fields inherited from class java.io.Writer |
lock |
Constructor Summary |
XmlWriter(java.io.Writer writer)
|
Methods inherited from class java.io.Writer |
append, append, append, write, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
indent
public int indent
XmlWriter
public XmlWriter(java.io.Writer writer)
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.IOException
- Calls
pop()
for each remaining open element, if any, and closes the stream.
- Specified by:
close
in interface java.io.Closeable
- Specified by:
close
in class java.io.Writer
- Throws:
java.io.IOException
write
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
- Specified by:
write
in class java.io.Writer
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush
in interface java.io.Flushable
- Specified by:
flush
in class java.io.Writer
- Throws:
java.io.IOException
Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)