public static String elementValue(Element element){
  if (element == null)   return null;
  element.normalize();
  Node textNode=element.getFirstChild();
  if (textNode == null)   return null;
  StringBuilder valueBuffer=new StringBuilder();
  do {
    if (textNode.getNodeType() == Node.CDATA_SECTION_NODE || textNode.getNodeType() == Node.TEXT_NODE) {
      valueBuffer.append(textNode.getNodeValue());
    }
  }
 while ((textNode=textNode.getNextSibling()) != null);
  return valueBuffer.toString();
}

public static String elementValue ( Element element ) { if ( element == null ) return null ; element . normalize ( ) ; Node textNode = element . getFirstChild ( ) ; if ( textNode == null ) return null ; StringBuilder valueBuffer = new StringBuilder ( ) ; do { if ( textNode . getNodeType ( ) == Node . CDATA_SECTION_NODE || textNode . getNodeType ( ) == Node . TEXT_NODE ) { valueBuffer . append ( textNode . getNodeValue ( ) ) ; } } while ( ( textNode = textNode . getNextSibling ( ) ) != null ) ; return valueBuffer . toString ( ) ; }
return the text ( node value ) of the first node under this , works best if normalized .
