public class XMLStringBuffer extends Object
Constructor and Description |
---|
XMLStringBuffer() |
XMLStringBuffer(IBuffer buffer,
String start) |
XMLStringBuffer(String start) |
Modifier and Type | Method and Description |
---|---|
void |
addCDATA(String content)
Add a CDATA tag.
|
void |
addComment(String comment) |
void |
addEmptyElement(String tagName)
Add an empty element tag (e.g.
|
void |
addEmptyElement(String tagName,
Properties attributes)
Add an empty element tag (e.g.
|
void |
addEmptyElement(String tagName,
String... attributes) |
void |
addOptional(String tagName,
Boolean value)
Add an optional Boolean element to the current tag.
|
void |
addOptional(String tagName,
Boolean value,
Properties attributes)
Add an optional Boolean element to the current tag.
|
void |
addOptional(String tagName,
String value)
Add an optional String element to the current tag.
|
void |
addOptional(String tagName,
String value,
Properties attributes)
Add an optional String element to the current tag.
|
void |
addOptional(String tagName,
String value,
String... attributes) |
void |
addRequired(String tagName,
String value)
Add a required element to the current tag.
|
void |
addRequired(String tagName,
String value,
Properties attributes)
Add a required element to the current tag.
|
void |
addRequired(String tagName,
String value,
String... attributes) |
void |
addString(String s) |
String |
getCurrentIndent() |
IBuffer |
getStringBuffer() |
static void |
main(String[] argv) |
void |
pop()
Pop the last pushed element without verifying it if matches the previously
pushed tag.
|
void |
pop(String tagName)
Pop the last pushed element and throws an AssertionError if it doesn't
match the corresponding tag that was pushed earlier.
|
void |
push(String tagName)
Push a new tag.
|
void |
push(String tagName,
Properties attributes)
Push a new tag.
|
void |
push(String tagName,
String... attributes) |
void |
push(String tagName,
String schema)
Push a new tag.
|
void |
push(String tagName,
String schema,
Properties attributes)
Push a new tag.
|
void |
setDocType(String docType)
Set the doctype for this document.
|
void |
setXmlDetails(String v,
String enc)
Set the xml version and encoding for this document.
|
void |
toWriter(Writer fw) |
String |
toXML() |
public XMLStringBuffer()
start
- A string of spaces indicating the indentation at which
to start the generation. Note that this constructor will also insert
an
public XMLStringBuffer(String start)
start
- A string of spaces indicating the indentation at which
to start the generation. This constructor will not insert an
public void setXmlDetails(String v, String enc)
v
- the XML versionenc
- the XML encodingpublic void setDocType(String docType)
docType
- The DOCTYPE string, without the "<!DOCTYPE " ">"public void push(String tagName, String schema, Properties attributes)
tagName
- The name of the tag.schema
- The schema to use (can be null or an empty string).attributes
- A Properties file representing the attributes (or null)public void push(String tagName, String schema)
tagName
- The name of the tag.schema
- The schema to use (can be null or an empty string).public void push(String tagName, Properties attributes)
tagName
- The name of the tag.attributes
- A Properties file representing the attributes (or null)public void push(String tagName)
tagName
- The name of the tag.public void pop()
public void pop(String tagName)
tagName
- The name of the tag this pop() is supposed to match.public void addRequired(String tagName, String value)
tagName
- The name of the tagvalue
- The value for this tagpublic void addRequired(String tagName, String value, Properties attributes)
tagName
- The name of the tagvalue
- The value for this tagattributes
- A Properties file containing the attributes (or null)public void addOptional(String tagName, String value, Properties attributes)
tagName
- The name of the tagvalue
- The value for this tagattributes
- A Properties file containing the attributes (or null)public void addOptional(String tagName, String value)
tagName
- The name of the tagvalue
- The value for this tagpublic void addOptional(String tagName, Boolean value, Properties attributes)
tagName
- The name of the tagvalue
- The value for this tagattributes
- A Properties file containing the attributes (or null)public void addOptional(String tagName, Boolean value)
tagName
- The name of the tagvalue
- The value for this tagpublic void addEmptyElement(String tagName)
tagName
- The name of the tagpublic void addEmptyElement(String tagName, Properties attributes)
tagName
- The name of the tagattributes
- A Properties file containing the attributes (or null)public void addComment(String comment)
public void addString(String s)
public void addCDATA(String content)
public IBuffer getStringBuffer()
public String toXML()
public static void main(String[] argv)
public String getCurrentIndent()
public void toWriter(Writer fw)
Copyright © 2015. All rights reserved.