Class XmlHelper

java.lang.Object
org.apache.struts2.config.providers.XmlHelper

public class XmlHelper extends Object
XML utilities.
Author:
Mike
  • Constructor Details

    • XmlHelper

      public XmlHelper()
  • Method Details

    • getParams

      public static Map<String,String> getParams(Element paramsElement)

      This method will find all the parameters under this paramsElement and return them as Map<String, String>. For example,

         <result ... >
            <param name="param1">value1</param>
            <param name="param2">value2</param>
            <param name="param3">value3</param>
         </result>
       

      will returns a Map<String, String> with the following key, value pairs:

      • param1 - value1
      • param2 - value2
      • param3 - value3
      Parameters:
      paramsElement - params element
      Returns:
      a map of key,value pairs
    • getContent

      public static String getContent(Element element)

      This method will return the content of this particular element. For example,

          <result>something_1</result>
       

      When the Element <result> is passed in as argument (element to this method, it returns the content of it, namely, something_1 in the example above.

      Parameters:
      element - the DOM element
      Returns:
      content as string
    • getLoadOrder

      public static Integer getLoadOrder(Document doc)
      Parameters:
      doc - document
      Returns:
      the value of the "order" attribute from the root element