List of utility methods to do XML Node Text Value
boolean | hasNodeText(Node n) Boolean testing whether or not the node in question is an Element with a single child text node. return (n.getNodeType() == Node.ELEMENT_NODE && n.hasChildNodes()
&& n.getFirstChild().getNodeType() == Node.TEXT_NODE && n.getFirstChild().equals(n.getLastChild()));
|
boolean | hasOnlyTextSiblings(@Nonnull Node node) has Only Text Siblings Node leftSibling = node.getPreviousSibling(); while (leftSibling != null) { if (!(leftSibling instanceof Text)) { return false; leftSibling = leftSibling.getPreviousSibling(); Node rightSibling = node.getNextSibling(); ... |
boolean | hasTextContent(final Node node) has Text Content final short nodeType = node.getNodeType(); return nodeType != Node.COMMENT_NODE && nodeType != Node.PROCESSING_INSTRUCTION_NODE; |
boolean | hasTextContent(Node n) has Text Content return (!"".equals(n.getTextContent().trim()) && !" ".equals(n.getTextContent().trim())); |