public static List<String> localText(Element self){
  List<String> result=new ArrayList<String>();
  if (self.getNodeType() == Node.TEXT_NODE || self.getNodeType() == Node.CDATA_SECTION_NODE) {
    result.add(self.getNodeValue());
  }
 else   if (self.hasChildNodes()) {
    NodeList nodeList=self.getChildNodes();
    for (int i=0; i < nodeList.getLength(); i++) {
      Node item=nodeList.item(i);
      if (item.getNodeType() == Node.TEXT_NODE || item.getNodeType() == Node.CDATA_SECTION_NODE) {
        result.add(item.getNodeValue());
      }
    }
  }
  return result;
}

public static List < String > localText ( Element self ) { List < String > result = new ArrayList < String > ( ) ; if ( self . getNodeType ( ) == Node . TEXT_NODE || self . getNodeType ( ) == Node . CDATA_SECTION_NODE ) { result . add ( self . getNodeValue ( ) ) ; } else if ( self . hasChildNodes ( ) ) { NodeList nodeList = self . getChildNodes ( ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { Node item = nodeList . item ( i ) ; if ( item . getNodeType ( ) == Node . TEXT_NODE || item . getNodeType ( ) == Node . CDATA_SECTION_NODE ) { result . add ( item . getNodeValue ( ) ) ; } } } return result ; }
returns the list of any direct string nodes of this node .
