Package edu.hm.hafner.util
Class XmlElementUtil
- java.lang.Object
-
- edu.hm.hafner.util.XmlElementUtil
-
public class XmlElementUtil extends Object
Provides some useful methods to process the DOM.- Author:
- Ullrich Hafner
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Element>getChildElementsByName(Element parent, String name)Returns all elements in the parent that match the specified name.static Optional<Element>getFirstChildElementByName(Element parent, String name)Returns the first element in the parent that match the specified name.static List<Element>nodeListToList(NodeList nodeList)Convert aNodeListinto aList<Element>.
-
-
-
Method Detail
-
getChildElementsByName
public static List<Element> getChildElementsByName(Element parent, String name)
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
public static Optional<Element> getFirstChildElementByName(Element parent, String name)
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
-
-