Package org.ametys.core.util.dom
Class DOMUtils
- java.lang.Object
-
- org.ametys.core.util.dom.DOMUtils
-
-
Constructor Summary
Constructors Modifier Constructor Description private
DOMUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Element
getChildElementByTagName(Element element, String name)
Retrieves the first child element of the given DOM element that matches the given element name.static List<Element>
getChildElements(Element element)
Retrieves all child elements of the given DOM element.static List<Element>
getChildElementsByTagName(Element element, String name)
Retrieves all child elements of the given DOM element that match the given element name.static Element
getFirstChildElement(Element element)
Get the first child element of the given DOM element.static List<Element>
getUniqueChildElements(Element element)
Retrieves some child elements of the given DOM element If some elements have the same tag name, only the first of these elements is retrievedstatic boolean
hasChildElement(Element element, String name)
Checks if the given DOM element has a child element that matches the given element name.
-
-
-
Constructor Detail
-
DOMUtils
private DOMUtils()
-
-
Method Detail
-
getChildElements
public static List<Element> getChildElements(Element element)
Retrieves all child elements of the given DOM element.- Parameters:
element
- The DOM element to analyze- Returns:
- a
List
of child elements instances
-
getFirstChildElement
public static Element getFirstChildElement(Element element)
Get the first child element of the given DOM element.- Parameters:
element
- The DOM element to analyze- Returns:
- the first child element or null if there is no child element
-
getUniqueChildElements
public static List<Element> getUniqueChildElements(Element element)
Retrieves some child elements of the given DOM element If some elements have the same tag name, only the first of these elements is retrieved- Parameters:
element
- the DOM element to analyze- Returns:
- a
List
of child elements instances
-
getChildElementsByTagName
public static List<Element> getChildElementsByTagName(Element element, String name)
Retrieves all child elements of the given DOM element that match the given element name. Only look at the direct child level of the given element. Do not go into further depth (in contrast to the DOM API's getElementsByTagName method).- Parameters:
element
- The DOM element to analyzename
- The child element name to look for- Returns:
- a
List
of child elements instances
-
getChildElementByTagName
public static Element getChildElementByTagName(Element element, String name)
Retrieves the first child element of the given DOM element that matches the given element name. Only look at the direct child level of the given element. Do not go into further depth.- Parameters:
element
- The DOM element to analyzename
- The child element name to look for- Returns:
- the first child element instance
-
hasChildElement
public static boolean hasChildElement(Element element, String name)
Checks if the given DOM element has a child element that matches the given element name.- Parameters:
element
- The DOM element to analyzename
- The child element name to look for- Returns:
true
if the given DOM element has a child element that matches the given element name,false
otherwise
-
-