public final class DomUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DomUtil.DomErrorHandler |
static class |
DomUtil.ElementByNameListFilter
Filters
Elements by their nodeName + namespaceUri |
static class |
DomUtil.ElementByTypeListFilter |
static class |
DomUtil.ElementNodeListFilter
Filter retaining only Nodes of type
Node.ELEMENT_NODE |
static interface |
DomUtil.NodeListFilter
A
DomUtil.NodeListFilter allows to filter a NodeList,
retaining only elements in the list which match the filter. |
| Constructor and Description |
|---|
DomUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List<DomElement> |
filterNodeList(NodeList nodeList,
DomUtil.NodeListFilter filter)
Allows to apply a
DomUtil.NodeListFilter to a NodeList. |
static List<DomElement> |
filterNodeListByName(NodeList nodeList,
String namespaceUri,
String localName)
Filter a
NodeList retaining all elements with a specific name |
static List<DomElement> |
filterNodeListByType(NodeList nodeList,
ModelInstanceImpl modelInstance,
Class<?> type)
Filter a
NodeList retaining all elements with a specific type |
static List<DomElement> |
filterNodeListForElements(NodeList nodeList)
Filters a
NodeList retaining all elements |
static DomDocument |
getEmptyDocument(DocumentBuilderFactory documentBuilderFactory)
Get an empty DOM document
|
static DomDocument |
parseInputStream(DocumentBuilderFactory documentBuilderFactory,
InputStream inputStream)
Create a new DOM document from the input stream
|
public static List<DomElement> filterNodeList(NodeList nodeList, DomUtil.NodeListFilter filter)
DomUtil.NodeListFilter to a NodeList. This allows to remove all elements from a node list which do not match the Filter.nodeList - the NodeList to filterfilter - the DomUtil.NodeListFilter to apply to the NodeListpublic static List<DomElement> filterNodeListForElements(NodeList nodeList)
NodeList retaining all elementsnodeList - the the NodeList to filterpublic static List<DomElement> filterNodeListByName(NodeList nodeList, String namespaceUri, String localName)
NodeList retaining all elements with a specific namenodeList - the NodeList to filternamespaceUri - the namespace for the elementslocalName - the local element name to filter forpublic static List<DomElement> filterNodeListByType(NodeList nodeList, ModelInstanceImpl modelInstance, Class<?> type)
NodeList retaining all elements with a specific typenodeList - the NodeList to filtermodelInstance - the model instancetype - the type class to filter forpublic static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory)
documentBuilderFactory - the factory to build to DOM documentModelParseException - if unable to create a new documentpublic static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream)
documentBuilderFactory - the factory to build to DOM documentinputStream - the input stream to parseModelParseException - if a parsing or IO error is triggeredCopyright © 2018. All rights reserved.