public class XMLBuilder extends Object
The motivation is to provide a similar interface to a document builder but instead of building an in-memory model, to directly stream the output.
Example usage:
XMLBuilder.Node closed = new XMLBuilder(false,writer) .root("xml") .node("div") .attr("attr", "attr1") .text("Content") .close() .node("div", "Content") .node("div") .node("div", "Content") .close() .close(); // The close on the root node will return null assert(closed == null); ContentContentContent
Modifier and Type | Class and Description |
---|---|
class |
XMLBuilder.Node |
Constructor and Description |
---|
XMLBuilder(boolean xml,
String encoding,
Writer w) |
XMLBuilder(Writer w) |
Modifier and Type | Method and Description |
---|---|
void |
closeAll(XMLBuilder.Node node) |
Writer |
getWriter()
Return the backing
Writer . |
XMLBuilder.Node |
root(String name) |
XMLBuilder.Node |
root(String name,
String nodeText) |
public XMLBuilder(Writer w) throws IOException
IOException
public XMLBuilder(boolean xml, String encoding, Writer w) throws IOException
IOException
public XMLBuilder.Node root(String name) throws IOException
IOException
public XMLBuilder.Node root(String name, String nodeText) throws IOException
IOException
public void closeAll(XMLBuilder.Node node) throws IOException
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.