src/main/java/org/jboss/util/xml/DOMUtils.java
public static String getTextContent(Node node, boolean replaceProps)
    {
        boolean hasTextContent = false;
        StringBuffer buffer = new StringBuffer();
        NodeList nlist = node.getChildNodes();
        for (int i = 0; i < nlist.getLength(); i++)
        {
            Node child = nlist.item(i);
            if (child.getNodeType() == Node.TEXT_NODE)
            {
                buffer.append(child.getNodeValue());
                hasTextContent = true;
            }
        }
        String text = (hasTextContent ? buffer.toString() : null);
        if ( text != null && replaceProps)
           text = StringPropertyReplacer.replaceProperties(text);

        return text;
    }
public static String getTextContent(Node node, boolean replaceProps)
    {
        boolean hasTextContent = false;
        StringBuffer buffer = new StringBuffer();
        NodeList nlist = node.getChildNodes();
        for (int i = 0; i < nlist.getLength(); i++)
        {
            Node child = nlist.item(i);
            if (child.getNodeType() == Node.TEXT_NODE)
            {
                buffer.append(child.getNodeValue());
                hasTextContent = true;
            }
        }
        String text = (hasTextContent ? buffer.toString() : null);
        if ( text != null && replaceProps)
           text = StringPropertyReplacer.replaceProperties(text);

        return text;
    }
public static String getTextContent ( Node node , boolean replaceProps ) { boolean hasTextContent = false ; StringBuffer buffer = new StringBuffer ( ) ; NodeList nlist = node . getChildNodes ( ) ; for ( int i = 0 ; i < nlist . getLength ( ) ; i ++ ) { Node child = nlist . item ( i ) ; if ( child . getNodeType ( ) == Node . TEXT_NODE ) { buffer . append ( child . getNodeValue ( ) ) ; hasTextContent = true ; } } String text = ( hasTextContent ? buffer . toString ( ) : null ) ; if ( text != null && replaceProps ) text = StringPropertyReplacer . replaceProperties ( text ) ; return text ; }
Get the concatenated text content, or null.
@param node node to search for TEXT_NODE conent
@param replaceProps flag indicating if ${x} property refs should be replace
@return the text content
Get the concatenated text content or null .