Package com.github.oowekyala.ooxml
Class DomUtils
java.lang.Object
com.github.oowekyala.ooxml.DomUtils
Simple utilities to work with the
org.w3c.dom API.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList(NamedNodeMap nodeList) Returns an unmodifiable view of the given nodemap as a list.Returns an unmodifiable view of the given nodelist as a list.Returns the list of children of the given element that are also elements.childrenNamed(Element element, String localName) Returns the list of children of the given element that are also elements.getAttributeOpt(Element element, String attributeName) Returns the value of the attribute with the given name as an optional.toMap(NamedNodeMap nodeList) Returns a new map of nodes built from the given node map.
-
Constructor Details
-
DomUtils
public DomUtils()
-
-
Method Details
-
children
Returns the list of children of the given element that are also elements. -
childrenNamed
Returns the list of children of the given element that are also elements. -
getAttributeOpt
Returns the value of the attribute with the given name as an optional.- Parameters:
element- Element to get the attribute fromattributeName- Attribute name (local name, no NS)
-
asList
Returns an unmodifiable view of the given nodelist as a list.- Parameters:
nodeList- A node list- Returns:
- A list view
-
asList
Returns an unmodifiable view of the given nodemap as a list. Note that as per the specification ofNamedNodeMap, elements are in no particular order, but this allows to iterate over them easily.- Parameters:
nodeList- A node map- Returns:
- A list view
-
toMap
Returns a new map of nodes built from the given node map. This uses local names to index the nodes. The returned map is modifiable.- Parameters:
nodeList- A node map- Returns:
- A new, modifiable map
-