public String text() {
        String previousText = null;
        StringBuilder buffer = null;
        for (Object child : this) {
            String text = null;
            if (child instanceof String) {
                text = (String) child;
            } else if (child instanceof Node) {
                text = ((Node) child).text();
            }
            if (text != null) {
                if (previousText == null) {
                    previousText = text;
                } else {
                    if (buffer == null) {
                        buffer = new StringBuilder();
                        buffer.append(previousText);
                    }
                    buffer.append(text);
                }
            }
        }
        if (buffer != null) {
            return buffer.toString();
        }
        if (previousText != null) {
            return previousText;
        }
        return "";
    }
public String text ( ) { String previousText = null ; StringBuilder buffer = null ; for ( Object child : this ) { String text = null ; if ( child instanceof String ) { text = ( String ) child ; } else if ( child instanceof Node ) { text = ( ( Node ) child ) . text ( ) ; } if ( text != null ) { if ( previousText == null ) { previousText = text ; } else { if ( buffer == null ) { buffer = new StringBuilder ( ) ; buffer . append ( previousText ) ; } buffer . append ( text ) ; } } } if ( buffer != null ) { return buffer . toString ( ) ; } if ( previousText != null ) { return previousText ; } return "" ; }
Returns the text value of all of the elements in the collection.

@return the text value of all the elements in the collection or null