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:
Content
Content
Content
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);
| 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
IOExceptionpublic XMLBuilder(boolean xml,
String encoding,
Writer w)
throws IOException
IOExceptionpublic XMLBuilder.Node root(String name) throws IOException
IOExceptionpublic XMLBuilder.Node root(String name, String nodeText) throws IOException
IOExceptionpublic void closeAll(XMLBuilder.Node node) throws IOException
IOExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.