List of utility methods to do XML Node Value Check
boolean | isCommentAllowed(Node node) is Comment Allowed short type = node.getNodeType(); return type == Node.ELEMENT_NODE || type == Node.TEXT_NODE; |
boolean | isCommentNode(Node node) Checks if the given Node is Comment Node if (node == null) return false; return (node.getNodeType() == Node.COMMENT_NODE); |
boolean | isContainerElement(Node node) is Container Element if (node == null || node.getNodeType() != Node.ELEMENT_NODE) { return false; final String ns = node.getNamespaceURI(); final String ln = node.getLocalName(); final Set<String> containerElementNames = CONTAINER_ELEMENTS.get(ns); return (containerElementNames != null && containerElementNames.contains(ln)); |
boolean | isCreateInstanceSet(Node node) Checks whether the optional attribute createInstance is set for a specific node. boolean createInstance = false; if (node.getAttributes().getNamedItem("createInstance") != null) { if (node.getAttributes().getNamedItem("createInstance").getNodeValue().equalsIgnoreCase("yes")) createInstance = true; return createInstance; |
boolean | isElementNodeExist(Node root, String nodeString) is Element Node Exist NodeList nlist = root.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { if (nlist.item(i) instanceof Element) { if (nlist.item(i).getNodeName().equalsIgnoreCase(nodeString)) { return true; if (nlist.item(i).hasChildNodes() && isElementNodeExist(nlist.item(i), nodeString)) { return true; ... |
boolean | isElementNodeOfType(final Node n, final String type) is Element Node Of Type return n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(type);
|
boolean | isElementType(Node _node) Shortcut for checking if given node is of type Element . return _node instanceof Element; |
boolean | isEmpty(Node node) Returns true if the specified node is null or has no children. return (node == null);
|
boolean | isEmptyTag(Node p_node) is Empty Tag boolean isEmptyTag = (p_node == null) ? true : (p_node.getFirstChild() == null ? true : false); return isEmptyTag; |
boolean | isEqual(Node a, Node b) Test two DOM nodes for equality, if both nodes are not equal to null then they are compared via Node#isEqualNode(Node) return (a == null) ? b == null : b != null && a.isEqualNode(b);
|