txw2.src.test.IndentingXMLStreamWriterTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
import com.sun.xml.txw2.output.IndentingXMLStreamWriter;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.XMLOutputFactory;
/**
* @author Kohsuke Kawaguchi
*/
public class IndentingXMLStreamWriterTest {
public static void main(String[] args) throws Exception {
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter w = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(System.out));
w.writeStartDocument();
w.writeStartElement("foo");
w.writeEmptyElement("bar");
w.writeStartElement("x");
w.writeCharacters("body");
w.writeEndElement();
w.writeEndElement();
w.writeEndDocument();
w.close();
}
}