List of utility methods to do XML Node Value Check
boolean | isNamedElement(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(); |
boolean | isNode(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);
|
boolean | isNodeAfter(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) ... |
boolean | isNodeNameEquals(Node node, String desiredName) is Node Name Equals return org.springframework.util.xml.DomUtils.nodeNameEquals(node, desiredName);
|
boolean | isNodeTheSame(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); |
boolean | isNodeTypeElement(Node node) is Node Type Element return node != null && node.getNodeType() == Node.ELEMENT_NODE;
|
boolean | isNullOrEmpty(Node node) is Null Or Empty return node == null || node.getTextContent().trim().isEmpty();
|
boolean | isOrphanNode(Node node) is Orphan Node if (node == null) return true; if (node.getNodeType() == Node.DOCUMENT_NODE) return false; return isOrphanNode(node.getParentNode()); |
boolean | isReturnTag(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) ... |
boolean | isSimpleValueProperty(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; ... |