public class XMLBuilder.Node extends Object
Modifier and Type | Method and Description |
---|---|
XMLBuilder.Node |
attr(String attr,
Object value)
Add an attribute value to an open element head.
|
XMLBuilder.Node |
close()
Close the open element.
|
XMLBuilder.Node |
close(boolean simpleEnd)
Close the open element.
|
XMLBuilder |
getBuilder()
Return the
XMLBuilder to which this XMLBuilder.Node belongs. |
XMLBuilder.Node |
node(String tag)
Create and return a new
XMLBuilder.Node . |
XMLBuilder.Node |
node(String tag,
String text)
Generate an open element for the tag, output the indicated text, and
then output the closing element for that tag.
|
XMLBuilder.Node |
text(String text)
Write out the text.
|
XMLBuilder.Node |
textNoEncode(String text)
Write out the text without encoding for (X)HTML.
|
String |
toString() |
public XMLBuilder getBuilder()
XMLBuilder
to which this XMLBuilder.Node
belongs.public XMLBuilder.Node attr(String attr, Object value) throws IOException
attr
- The name of the attribute.value
- The value of the attribute, which will be automatically
encoded.XMLBuilder.Node
IOException
public XMLBuilder.Node text(String text) throws IOException
The head for the current element is first closed if it was still open. Then the text is then encoded and written out.
This does not generate the closing tag for the node. More text or embedded nodes can still be output.
text
- The text, which will be automatically encoded in a manner
suitable for a CDATA section.XMLBuilder.Node
IOException
public XMLBuilder.Node textNoEncode(String text) throws IOException
The head for the current element is first closed if it was still open. Then the text is NOT encoded before written out.
This does not generate the closing tag for the node. More text or embedded nodes can still be output.
text
- The text, which will be automatically encoded in a manner
suitable for a CDATA section.XMLBuilder.Node
IOException
public XMLBuilder.Node node(String tag) throws IOException
XMLBuilder.Node
. The head of the XMLBuilder.Node
will be open. Attributes may be specified until the closing tag is
generated by close()
or until the head of the node is
closed by text(String)
.tag
- The tag for that XMLBuilder.Node
.XMLBuilder.Node
.IOException
public XMLBuilder.Node node(String tag, String text) throws IOException
tag
- The tag (element name).text
- The text, which will be automatically encoded as
appropriate for a CDATA section.XMLBuilder.Node
.IOException
public XMLBuilder.Node close() throws IOException
IOException
public XMLBuilder.Node close(boolean simpleEnd) throws IOException
simpleEnd
- When true
an open tag without a body will be
closed by a single > symbol rather than the XML style
/>.IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.