Package org.ametys.core.util.dom
Class DOMUtils
java.lang.Object
org.ametys.core.util.dom.DOMUtils
Some useful utility methods for
Element
use-
Method Summary
Modifier and TypeMethodDescriptionstatic Element
getChildElementByTagName
(Element element, String name) Retrieves the first child element of the given DOM element that matches the given element name.getChildElements
(Element element) Retrieves all child elements of the given DOM 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.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.
-
Method Details
-
getChildElements
Retrieves all child elements of the given DOM element.- Parameters:
element
- The DOM element to analyze- Returns:
- a
List
of child elements instances
-
getFirstChildElement
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
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
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
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
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
-