public final class Nodes
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static char |
SPACE |
Modifier | Constructor and Description |
---|---|
private |
Nodes() |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<javax.xml.namespace.QName,java.lang.String> |
getAttributes(org.w3c.dom.Node n)
Obtains an element's attributes as Map.
|
static java.lang.String |
getMergedNestedText(org.w3c.dom.Node n)
Tries to merge all direct Text and CDATA children of the given
Node and concatenates their value.
|
static javax.xml.namespace.QName |
getQName(org.w3c.dom.Node n)
Extracts a Node's name, namespace URI (if any) and prefix as a
QName.
|
private static void |
handleWsRec(org.w3c.dom.Node n,
boolean normalize)
Trims textual content of this node, removes empty text and
CDATA children, recurses into its child nodes.
|
(package private) static java.lang.String |
normalize(java.lang.String s)
Normalize a string.
|
static org.w3c.dom.Node |
normalizeWhitespace(org.w3c.dom.Node original)
Creates a new Node (of the same type as the original node) that
is similar to the orginal but doesn't contain any empty text or
CDATA nodes and where all textual content including attribute
values or comments are trimmed and normalized.
|
private static void |
stripECW(org.w3c.dom.Node n) |
static org.w3c.dom.Node |
stripElementContentWhitespace(org.w3c.dom.Node original)
Creates a new Node (of the same type as the original node) that
is similar to the orginal but doesn't contain any text or CDATA
nodes that only consist of whitespace.
|
static org.w3c.dom.Node |
stripWhitespace(org.w3c.dom.Node original)
Creates a new Node (of the same type as the original node) that
is similar to the orginal but doesn't contain any empty text or
CDATA nodes and where all textual content including attribute
values or comments are trimmed.
|
private static final char SPACE
public static javax.xml.namespace.QName getQName(org.w3c.dom.Node n)
public static java.lang.String getMergedNestedText(org.w3c.dom.Node n)
public static java.util.Map<javax.xml.namespace.QName,java.lang.String> getAttributes(org.w3c.dom.Node n)
public static org.w3c.dom.Node stripWhitespace(org.w3c.dom.Node original)
public static org.w3c.dom.Node normalizeWhitespace(org.w3c.dom.Node original)
"normalized" in this context means all whitespace characters are replaced by space characters and consecutive whitespace characaters are collapsed.
public static org.w3c.dom.Node stripElementContentWhitespace(org.w3c.dom.Node original)
This doesn't have any effect if applied to a text or CDATA node itself.
private static void handleWsRec(org.w3c.dom.Node n, boolean normalize)
normalize
- whether to normalize whitespace as wellstatic java.lang.String normalize(java.lang.String s)
"normalized" in this context means all whitespace characters are replaced by space characters and consecutive whitespace characaters are collapsed.
private static void stripECW(org.w3c.dom.Node n)