public class XmlBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected Stack<String> |
m_openElements |
Constructor and Description |
---|
XmlBuilder()
Constructor.
|
XmlBuilder(boolean autoPad)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
closeTag()
Closes an open tag.
|
String |
getXML()
Get the xml.
|
void |
openTag(String name)
Writes an opening tag
|
void |
openTag(String name,
HashMap<Object,String> attributes)
Writes an opening tag with attributes.
|
void |
openTag(String name,
String attrName,
String attrValue)
Writes an opening tag with one attribute.
|
void |
openTag(String name,
String attr1Name,
String attr1Value,
String attr2Name,
String attr2Value)
Writes an opening tag with two attributes.
|
void |
reset()
Reset this XmlBuilder.
|
void |
setEncoding(String encoding)
Sets the encoding used in the XML.
|
void |
writeComment(String comment)
Adds a comment to the xml.
|
void |
writeHeader()
Writes the XML document header.
|
void |
writeRaw(String raw)
Adds raw data to the xml.
|
void |
writeTag(String name,
HashMap<Object,String> attributes)
Adds a opening and closing tag with attributes.
|
void |
writeTag(String name,
String data)
Adds a opening and closing tag with charcter data.
|
void |
writeTag(String name,
String data,
HashMap<Object,String> attributes)
Adds a opening and closing tag with attributes and character data.
|
void |
writeTag(String name,
String data,
String attrName,
String attrValue)
Adds a opening and closing tag with an attribute and character data.
|
void |
writeTag(String name,
String attr1Name,
String attr1Value,
String attr2Name,
String attr2Value)
Adds a opening and closing tag with an attribute and character data.
|
void |
writeTag(String name,
String data,
String attr1Name,
String attr1Value,
String attr2Name,
String attr2Value)
Adds a opening and closing tag with two attributes and character data.
|
public XmlBuilder()
public XmlBuilder(boolean autoPad)
autoPad
- if set, the XML document to be generated will
automatically be indented.public void reset()
public void writeRaw(String raw)
public void writeComment(String comment)
public void writeHeader()
public void setEncoding(String encoding)
encoding
- public void writeTag(String name, String data)
public void writeTag(String name, HashMap<Object,String> attributes)
public void writeTag(String name, String attr1Name, String attr1Value, String attr2Name, String attr2Value)
public void writeTag(String name, String data, String attrName, String attrValue)
public void writeTag(String name, String data, String attr1Name, String attr1Value, String attr2Name, String attr2Value)
public void writeTag(String name, String data, HashMap<Object,String> attributes)
public void openTag(String name)
public void openTag(String name, String attrName, String attrValue)
public void openTag(String name, String attr1Name, String attr1Value, String attr2Name, String attr2Value)
public void openTag(String name, HashMap<Object,String> attributes)
public void closeTag()
public String getXML()