Class XMLDOMUtil


  • public class XMLDOMUtil
    extends Object
    • Constructor Detail

      • XMLDOMUtil

        public XMLDOMUtil()
    • Method Detail

      • mapifyAttrs

        public static Map<String,​String> mapifyAttrs​(Node node,
                                                           Map<String,​String> overwrite)
        This grabs the attributes from a dom node and overwrites those values with those specified by the overwrite map.
        Parameters:
        node - node for building
        overwrite - map of attributes to overwrite
        Returns:
        map of attributes
      • getInt

        public static int getInt​(String attrName,
                                 Map<String,​String> runtimeAttributes,
                                 Node docElement)
        Get an int value. Try the runtime attributes first and then back off to the document element. Throw a RuntimeException if the attribute is not found or if the value is not parseable as an int.
        Parameters:
        attrName - attribute name to find
        runtimeAttributes - runtime attributes
        docElement - correct element that should have specified attribute
        Returns:
        specified int value
      • getLong

        public static long getLong​(String attrName,
                                   Map<String,​String> runtimeAttributes,
                                   Node docElement)
        Get a long value. Try the runtime attributes first and then back off to the document element. Throw a RuntimeException if the attribute is not found or if the value is not parseable as a long.
        Parameters:
        attrName - attribute name to find
        runtimeAttributes - runtime attributes
        docElement - correct element that should have specified attribute
        Returns:
        specified long value