Class XMLUtils


  • public class XMLUtils
    extends Object
    Handy methods for dealing with XML.
    Author:
    pavlidis
    • Constructor Detail

      • XMLUtils

        public XMLUtils()
    • Method Detail

      • extractMultipleChildren

        public static List<String> extractMultipleChildren​(Node parent,
                                                           String elementName)
      • extractOneChildText

        public static String extractOneChildText​(Node parent,
                                                 String elementName)
      • extractOneChild

        public static Node extractOneChild​(Node parent,
                                           String elementName)
      • extractTagData

        public static Collection<String> extractTagData​(Document doc,
                                                        String tag)
        Parameters:
        doc - - the xml document to search through
        tag - -the name of the element we are looking for
        Returns:
        a collection of strings that represent all the data contained within the given tag (for each instance of that tag)
      • getTextValue

        public static String getTextValue​(Element ele)
        Make the horrible DOM API slightly more bearable: get the text value we know this element contains. Borrowed from the Spring API. Using Node.getTextContent() to fix failing tests, if there is a problem, see history before Feb 22. 2018 Also, this is the previous note (related to the code I removed): * Note that we can't really use the alternative Node.getTextContent() because it isn't supported by older Xerces * implementations (1.x), which tend to leak into the classloader. Causes recurring problems with tests.
        Parameters:
        ele - element
        Returns:
        text value