common_helper/src/main/java/com/xiongyingqi/util/xml/DomUtils.java
public static String getTextValue(Element valueEle) {
        Assert.notNull(valueEle, "Element must not be null");
        StringBuilder sb = new StringBuilder();
        NodeList nl = valueEle.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node item = nl.item(i);
            if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
                sb.append(item.getNodeValue());
            }
        }
        return sb.toString();
    }
public static String getTextValue(Element valueEle) {
        Assert.notNull(valueEle, "Element must not be null");
        StringBuilder sb = new StringBuilder();
        NodeList nl = valueEle.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node item = nl.item(i);
            if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
                sb.append(item.getNodeValue());
            }
        }
        return sb.toString();
    }
public static String getTextValue ( Element valueEle ) { Assert . notNull ( valueEle , "Element must not be null" ) ; StringBuilder sb = new StringBuilder ( ) ; NodeList nl = valueEle . getChildNodes ( ) ; for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { Node item = nl . item ( i ) ; if ( ( item instanceof CharacterData && ! ( item instanceof Comment ) ) || item instanceof EntityReference ) { sb . append ( item . getNodeValue ( ) ) ; } } return sb . toString ( ) ; }
Extracts the text value from the given DOM element, ignoring XML comments.
<p>Appends all CharacterData nodes and EntityReference nodes into a single
String value, excluding Comment nodes. Only exposes actual user-specified
text, no default values of any kind.

@see org.w3c.dom.CharacterData
@see org.w3c.dom.EntityReference
@see org.w3c.dom.Comment
Extracts the text value from the given DOM element ignoring XML comments . <p > Appends all CharacterData nodes and EntityReference nodes into a single String value excluding Comment nodes . Only exposes actual user - specified text no default values of any kind .