Java Utililty Methods XML Node Value Check

List of utility methods to do XML Node Value Check

Description

The list of methods to do XML Node Value Check are organized into topic(s).

Method

booleanisNamedElement(final Node aNode)
Checks if the supplied DOM Node is a DOM Element having a defined "name" attribute.
final boolean isElementNode = aNode != null && aNode.getNodeType() == Node.ELEMENT_NODE;
return isElementNode && getNamedAttribute(aNode, NAME_ATTRIBUTE) != null
        && !getNamedAttribute(aNode, NAME_ATTRIBUTE).isEmpty();
booleanisNode(Object value, String nodeName)
Returns true if the user object is an XML node with the specified type and and the optional attribute has the specified value or is not specified.
return isNode(value, nodeName, null, null);
booleanisNodeAfter(Node node1, Node node2)
Figure out whether node2 should be considered as being later in the document than node1, in Document Order as defined by the XPath model.
if (node1 == node2 || isNodeTheSame(node1, node2))
    return true;
boolean isNodeAfter = true;
Node parent1 = getParentOfNode(node1);
Node parent2 = getParentOfNode(node2);
if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) 
    if (null != parent1)
...
booleanisNodeNameEquals(Node node, String desiredName)
is Node Name Equals
return org.springframework.util.xml.DomUtils.nodeNameEquals(node, desiredName);
booleanisNodeTheSame(Node node1, Node node2)
Use DTMNodeProxy to determine whether two nodes are the same.
if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
    return ((DTMNodeProxy) node1).equals((DTMNodeProxy) node2);
else
    return (node1 == node2);
booleanisNodeTypeElement(Node node)
is Node Type Element
return node != null && node.getNodeType() == Node.ELEMENT_NODE;
booleanisNullOrEmpty(Node node)
is Null Or Empty
return node == null || node.getTextContent().trim().isEmpty();
booleanisOrphanNode(Node node)
is Orphan Node
if (node == null)
    return true;
if (node.getNodeType() == Node.DOCUMENT_NODE)
    return false;
return isOrphanNode(node.getParentNode());
booleanisReturnTag(Node node)
This method determines if the provided node generates a carriage return.
String nodeName = node.getNodeName().toLowerCase();
return "br".equals(nodeName) 
        || "hr".equals(nodeName) 
        || "img".equals(nodeName) 
        || "h1".equals(nodeName) 
        || "h2".equals(nodeName) 
        || "h3".equals(nodeName) 
        || "h4".equals(nodeName) 
...
booleanisSimpleValueProperty(Node node)
is Simple Value Property
if (node instanceof Attr) {
    return true;
} else {
    Element element = (Element) node;
    NodeList childNodes = element.getChildNodes();
    int len = (childNodes != null) ? childNodes.getLength() : 0;
    if (len == 0)
        return true;
...