Package org.apache.jorphan.util
Class XMLBuffer
- java.lang.Object
-
- org.apache.jorphan.util.XMLBuffer
-
public class XMLBuffer extends Object
Provides XML string building methods. Not synchronised.
-
-
Constructor Summary
Constructors Constructor Description XMLBuffer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLBuffer
closeTag(String tagname)
Close top tag from stack.XMLBuffer
openTag(String tagname)
Open a tag; save on stack.XMLBuffer
tag(String tagname, String content)
Add a complete tag with content.XMLBuffer
tag(String tagname, StringBuilder content)
Add a complete tag with content.String
toString()
Convert the buffer to a string, closing any open tags
-
-
-
Method Detail
-
openTag
public XMLBuffer openTag(String tagname)
Open a tag; save on stack.- Parameters:
tagname
- name of the tag- Returns:
- this
-
closeTag
public XMLBuffer closeTag(String tagname)
Close top tag from stack.- Parameters:
tagname
- name of the tag to close- Returns:
- this
- Throws:
IllegalArgumentException
- if the tag names do not match
-
tag
public XMLBuffer tag(String tagname, String content)
Add a complete tag with content.- Parameters:
tagname
- name of the tagcontent
- content to put in tag, or empty content, if an empty tag should be used- Returns:
- this
-
tag
public XMLBuffer tag(String tagname, StringBuilder content)
Add a complete tag with content.- Parameters:
tagname
- name of the tagcontent
- content to put in tag, or empty content, if an empty tag should be used- Returns:
- this
-
-