public static String getStringValue ( final Element element ) { final StringBuilder buf = new StringBuilder ( ) ; final NodeList children = element . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { final Node n = children . item ( i ) ; switch ( n . getNodeType ( ) ) { case Node . TEXT_NODE : buf . append ( n . getNodeValue ( ) ) ; break ; case Node . ELEMENT_NODE : buf . append ( getStringValue ( ( Element ) n ) ) ; break ; } } return buf . toString ( ) ; }
Get element node string value .