title: Unable to get data from CDATA in Java
body: <p>I have the following simple piece of code:</p>
  
  <pre><code>NodeList nodeList = document.getDocumentElement().getChildNodes();
          for (int i = 0; i &lt; nodeList.getLength(); i++) {
              Node vtvRespNode = nodeList.item(i);
              NodeList cardNodes = vtvRespNode.getChildNodes();
              for (int j = 0; j &lt; cardNodes.getLength(); j++) {
                  Node cardNode = cardNodes.item(j);
                  Card card = vtvResponse.new Card();
                  if (cardNode instanceof Element) {
                      String content = cardNode.getLastChild().getTextContent().trim();
                      if(cardNode.getNodeName().equals(CARD_TYPE)) {
                          Log.i(TAG,"cardType set for this card: "+content);
                      }
                      else if(cardNode.getNodeName().equals(TTL)) {
                          Log.i(TAG,"TTL set for this card: "+content);
                      }
                      else if(cardNode.getNodeName().equals(LOCAL_TIME_STAMP)) {
                          Log.i(TAG,"localtimeStamp set for this card: "+content);
                      }
                      else if(cardNode.getNodeName().equals(CARD_BLOB)) {
                          CharacterData child = (CharacterData) cardNode.getFirstChild();
                          if(child instanceof CharacterData){
                              Log.i(TAG,"cardNode is instanceof CharacterData");
                              content = child.getData();
                          }
                          Log.i(TAG,"blob set for this card: "+content);
                      }
                  }
              }
          }
  </code></pre>
  
  <p>Now, I have this sample xml:</p>
  
  <pre><code>&lt;VtvResp&gt;
      &lt;CI&gt;
          &lt;localts&gt; 1233546 &lt;/localts&gt;
          &lt;ctype&gt; 4 &lt;/ctype&gt;
          &lt;ttl&gt; 76542 &lt;/ttl&gt;
          &lt;card&gt; &lt;![CDATA[{"timezone": 330.0, "date": "03/10/13", "windspeed": "15", "weather": "Partly Cloudy", "temperature":               "28", "time": "04:02", "city_name": "Bangalore", "country": "India", "day": "thursday", "meridian": "pm"}]]&gt;
          &lt;/card&gt;
      &lt;/CI&gt;
  
  &lt;/VtvResp&gt;
  </code></pre>
  
  <p>Here, I'm not able to get the CDATA data from the xml. The last Log of the <code>else if</code> blob always returns a blank string and I'm not able to figure out what I'm doing wrong.
  Plz help !!</p>