return null;
NodeList nl = n.getChildNodes(); for(int i = 0; i < nl.getLength(); i++) { Node c = nl.item(i); if (c.getNodeType() == Node.TEXT_NODE) { textContent = n.getNodeValue(); if (textContent == null) {  String s = c.toString(); int idx = s.indexOf("#text:"); if (idx != -1) { textContent = s.substring(idx + 6).trim(); } if (textContent.endsWith("]")) { textContent = textContent.substring(0, textContent.length() - 1); } } if (textContent == null) { break; } } }   String s = n.toString(); int i = s.indexOf('>'); int i2 = s.indexOf("</"); if (i != -1 && i2 != -1) { textContent = s.substring(i + 1, i2); }
   public static String getTextContent(Node n) throws XMLException   {      if (n.hasChildNodes())      {         StringBuffer sb = new StringBuffer();         NodeList nl = n.getChildNodes();         for(int i = 0; i < nl.getLength(); i++)         {            sb.append(XMLUtil.elementToString(nl.item(i)));            if (i < nl.getLength() - 1)            {               sb.append('\n');            }         }         String s = sb.toString();         if (s.length() != 0)         {            return s;         }      }      Method[] methods = Node.class.getMethods();      for(int i = 0; i < methods.length; i++)      {         if("getTextContent".equals(methods[i].getName()))         {            Method getTextContext = methods[i];            try            {               return (String)getTextContext.invoke(n, EMPTY_ARRAY);            }            catch(Exception e)            {               log.error("Failed to invoke getTextContent() on node " + n, e);               return null;            }         }      }      // JDK 1.4      String s = n.toString();      int i = s.indexOf('>');      int i2 = s.indexOf("</");      if (i == -1 || i2 == -1)      {         return null;      }      return s.substring(i + 1, i2);   }