title: Parse CDATA from RSS feed in android
body: <p>I know there is lot of Q&amp;A about parsing CDATA in android. But actually they didn't helps me yet. My problem is that I cannot get whole data from CDATA. Here is my feed.</p>
  
  <pre><code>&lt;item&gt;
  &lt;title&gt;
  SocialStory and Thomson Reuters Foundation TrustLaw Connect Meetup
  &lt;/title&gt;
  &lt;link&gt;
  http://yourstory.in/2013/06/socialstory-and-thomson-reuters-foundation-trustlaw-connect-meetup/
  &lt;/link&gt;
  &lt;comments&gt;
  http://yourstory.in/2013/06/socialstory-and-thomson-reuters-foundation-trustlaw-connect-meetup/#comments
  &lt;/comments&gt;
  &lt;pubDate&gt;Wed, 12 Jun 2013 04:21:54 +0000&lt;/pubDate&gt;
  &lt;dc:creator&gt;Vallabh Rao&lt;/dc:creator&gt;
  &lt;category&gt;
  &lt;![CDATA[ Events ]]&gt;
  &lt;/category&gt;
  &lt;guid isPermaLink="false"&gt;http://yourstory.in/?p=75912&lt;/guid&gt;
  &lt;description&gt;
  &lt;![CDATA[
  SocialStory, the social entrepreneurship and impact investing sector media platform of YourStory.in, is organizing a meetup with Thomson Reuters Foundation TrustLaw Connect programme at the YourStory.in office on 21st June, 2013 from 2:30PM to 4:30PM. Mumbai based Program Manager at Trust Law at Thomson Reuters Foundation, Urvashi Devidayal  will be interacting with and taking questions [...] &lt;a class="read-more" href="http://yourstory.in/2013/06/socialstory-and-thomson-reuters-foundation-trustlaw-connect-meetup/"&gt;Read More&lt;/a&gt;
  ]]&gt;
  &lt;/description&gt;
  &lt;content:encoded&gt;
  &lt;![CDATA[
  &lt;p&gt;SocialStory, the social entrepreneurship and impact investing sector media platform of YourStory.in, is organizing a meetup with Thomson Reuters Foundation TrustLaw Connect programme at the YourStory.in office on 21st June, 2013 from 2:30PM to 4:30PM. Mumbai based Program Manager at Trust Law at Thomson Reuters Foundation, Urvashi Devidayal  will be interacting with and taking questions about the programme from interested social enterprise and non-profit representatives.&lt;/p&gt; &lt;p&gt;TrustLaw Connect is the Thomson Reuters Foundation&amp;#8217;s global pro bono service that amplifies the impact of NGOs and social enterprises by connecting them with the best lawyers around the world. Launched in 2010, TrustLaw Connect has grown to include over 1,200 members in 120 countries.&lt;/p&gt; &lt;p&gt;&lt;a href="http://social.yourstory.in/2013/06/socialstory-and-thomson-reuters-foundation-trustlaw-connect-meetup/" target="_blank"&gt;Click here to read more and register to attend. &lt;/a&gt;&lt;/p&gt;
  ]]&gt;
  &lt;/content:encoded&gt;
  &lt;wfw:commentRss&gt;
  http://yourstory.in/2013/06/socialstory-and-thomson-reuters-foundation-trustlaw-connect-meetup/feed/
  &lt;/wfw:commentRss&gt;
  &lt;slash:comments&gt;0&lt;/slash:comments&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>I want to get the all data inside the <code>&lt;/content:encoded&gt;</code> tag, especially the image sources. I don't know how to get it.</p>
  
  <p>Here is my <code>RSSHandler</code> class.</p>
  
  <pre><code>public class RSSHandler extends DefaultHandler {
  
      final int state_unknown = 0;
      final int state_title = 1;
      final int state_description = 2;
      final int state_link = 3;
      final int state_pubdate = 4;
      final int state_creator= 5;
      final int state_encoded =6;
      int currentState = state_unknown;
  
      static String encoded_text = " ";
  
      RSSFeed feed;
      RSSItem item;
  
      boolean itemFound = false;
  
      RSSHandler(){
      }
  
      RSSFeed getFeed(){
          return feed;
      }
  
      @Override
      public void startDocument() throws SAXException {
          // TODO Auto-generated method stub
          feed = new RSSFeed();
          item = new RSSItem();
  
      }
  
      @Override
      public void endDocument() throws SAXException {
          // TODO Auto-generated method stub
      }
  
      @Override
      public void startElement(String uri, String localName, String qName,
              Attributes attributes) throws SAXException {
          // TODO Auto-generated method stub
  
          if (localName.equalsIgnoreCase("item")){
              itemFound = true;
              item = new RSSItem();
              currentState = state_unknown;
          }
          else if (localName.equalsIgnoreCase("title")){
              Log.e("node_title",localName);
              currentState = state_title;
          }
          else if (localName.equalsIgnoreCase("description")){
              currentState = state_description;
          }
          else if (localName.equalsIgnoreCase("link")){
              currentState = state_link;
          }
          else if (localName.equalsIgnoreCase("pubdate")){
              currentState = state_pubdate;
          }
          else if (localName.equalsIgnoreCase("creator")){
  
              currentState = state_creator;
          }
  
          else{
              currentState = state_unknown;
          }
  
      }
  
      @Override
      public void endElement(String uri, String localName, String qName)
              throws SAXException {
          // TODO Auto-generated method stub
          if (localName.equalsIgnoreCase("item")){
              feed.addItem(item);
          }
      }
  
      @Override
      public void characters(char[] ch, int start, int length)
              throws SAXException {
          // TODO Auto-generated method stub
  
          String strCharacters = new String(ch,start,length);
  
          if (itemFound==true){
              // "item" tag found, it's item's parameter
              switch(currentState){
              case state_title:
                  item.setTitle(strCharacters);
  
                  Log.e("title",strCharacters);
                  break;
              case state_description:
                  item.setDescription(strCharacters);
                  break;
              case state_link:
                  item.setLink(strCharacters);
                  break;
              case state_pubdate:
                  item.setPubdate(strCharacters);
                  break;
              case state_creator:
                  item.setCreator(strCharacters);
                  break;
  
              default:
                  break;
              }
          }
          else{
              // not "item" tag found, it's feed's parameter
              switch(currentState){
              case state_title:
                  feed.setTitle(strCharacters);
                  break;
              case state_description:
                  feed.setDescription(strCharacters);
                  break;
              case state_link:
                  feed.setLink(strCharacters);
                  break;
              case state_pubdate:
                  feed.setPubdate(strCharacters);
                  break;  
              case state_creator:
                  feed.setCreator(strCharacters);
                  break;
  
              default:
                  break;
              }
          }
  
          currentState = state_unknown;
      }
  
  
  
  }
  </code></pre>