Class XMLBuffer

java.lang.Object
org.apache.jorphan.util.XMLBuffer

public class XMLBuffer extends Object
Provides XML string building methods. Not synchronised.
  • Constructor Details

    • XMLBuffer

      public XMLBuffer()
  • Method Details

    • 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, CharSequence content)
      Add a complete tag with content.
      Parameters:
      tagName - name of the tag
      content - content to put in tag, or empty content, if an empty tag should be used
      Returns:
      this
    • toString

      public String toString()
      Convert the buffer to a string, closing any open tags
      Overrides:
      toString in class Object