Class XmlBuilder

java.lang.Object
org.frankframework.util.XmlBuilder

public class XmlBuilder extends Object
Builds an XML-element with attributes and sub-elements. Attributes can be added with the addAttribute method, the content can be set with the setValue method. Sub elements can be added with the addSubElement method. the toXML function returns the node and sub nodes as an indented xml string.

If possible, use SaxDocumentBuilder or IDocumentBuilder (from DocumentBuilderFactory)

Author:
Johan Verrips, Peter Leeuwenburgh
  • Field Details

    • log

      protected org.apache.logging.log4j.Logger log
  • Constructor Details

    • XmlBuilder

      public XmlBuilder(String tagName)
  • Method Details

    • create

      public static XmlBuilder create(String tagName)
    • addAttribute

      public void addAttribute(String name, String value)
    • addAttribute

      public void addAttribute(String name, boolean value)
    • addAttribute

      public void addAttribute(String name, long value)
    • addSubElement

      public void addSubElement(String name, String value)
    • addSubElement

      public void addSubElement(XmlBuilder newElement)
    • setCdataValue

      public void setCdataValue(String value)
    • setValue

      public void setValue(String value)
    • setValue

      public void setValue(String value, boolean encode)
    • asMessage

      public Message asMessage()
    • asXmlString

      public String asXmlString()