Class XmlUtil


  • public final class XmlUtil
    extends Object
    This class provides utils for XML document management.
    • Method Detail

      • getXmlHeader

        public static String getXmlHeader()
        Gets the header of an XML file
        Returns:
        The header
      • addElement

        public static void addElement​(StringBuffer strXmlBuffer,
                                      String strTag,
                                      String strValue)
        Add an element to an XML document buffer
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        strValue - The value of the element
      • addEmptyElement

        public static void addEmptyElement​(StringBuffer strXmlBuffer,
                                           String strTag,
                                           Map<?,​?> attrList)
        Add an empty element (< />) to an XML document buffer.
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        attrList - The attributes list
      • addElement

        public static void addElement​(StringBuffer strXmlBuffer,
                                      String strTag,
                                      String strValue,
                                      Map<?,​?> attrList)
        Add an element to an XML document buffer with attributes
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        strValue - The value of the element
        attrList - the attribute list
      • addElement

        public static void addElement​(StringBuffer strXmlBuffer,
                                      String strTag,
                                      int nValue)
        Add an element to an XML document buffer.
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        nValue - The value of the element
      • addElementHtml

        public static void addElementHtml​(StringBuffer strXmlBuffer,
                                          String strTag,
                                          String strValue)
        Add a CDATA type element to XML document buffer.
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        strValue - The value of the element
      • addElementHtml

        public static void addElementHtml​(StringBuffer strXmlBuffer,
                                          String strTag,
                                          String strValue,
                                          Map<?,​?> attrList)
        Add a CDATA type element to XML document buffer.
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        strValue - The value of the element
        attrList - The attributes list
      • beginElement

        public static void beginElement​(StringBuffer strXmlBuffer,
                                        String strTag)
        Add an opening tag for an element in a XML document buffer
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
      • beginElement

        public static void beginElement​(StringBuffer strXmlBuffer,
                                        String strTag,
                                        Map<?,​?> attrList)
        Add an opening tag for an element in a XML document buffer
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add
        attrList - The attributes list
      • endElement

        public static void endElement​(StringBuffer strXmlBuffer,
                                      String strTag)
        Add a closing tag for an element in a XML document buffer
        Parameters:
        strXmlBuffer - The XML document buffer
        strTag - The tag name of the element to add