Package edu.hm.hafner.util
Class XmlElementUtil
java.lang.Object
edu.hm.hafner.util.XmlElementUtil
Provides some useful methods to process the DOM.
- Author:
- Ullrich Hafner
-
Method Summary
Modifier and TypeMethodDescriptiongetChildElementsByName(Element parent, String name) Returns all elements in the parent that match the specified name.getFirstChildElementByName(Element parent, String name) Returns the first element in the parent that match the specified name.nodeListToList(NodeList nodeList) Convert aNodeListinto aList<Element>.
-
Method Details
-
getChildElementsByName
Returns all elements in the parent that match the specified name.- Parameters:
parent- the parent elementname- the expected name of the childs- Returns:
- the elements, the list might be empty if there is no match
-
getFirstChildElementByName
Returns the first element in the parent that match the specified name.- Parameters:
parent- the parent elementname- the expected name of the childs- Returns:
- the first element if there is a match,
Optional.empty()otherwise
-
nodeListToList
Convert aNodeListinto aList<Element>. Also filters out non elements from the node list.- Parameters:
nodeList- node list to convert.- Returns:
- list of elements.
-