title: Android RSS reader problems
body: <p>I have been trying to create a simple app that parse an entire channel into a string and print it and also that can save parsed data into a sqlite db in the future. I've been following <a href="http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser/" rel="nofollow">tutorial1</a> and <a href="http://www.anddev.org/novice-tutorials-f8/parsing-xml-from-the-net-using-the-saxparser-t353.html" rel="nofollow">tutorial2</a>
  I also read the IBM tutorial together with 3-4 other implementations of RSS readers but cant figure whats wrong</p>
  
  <p>Item.java</p>
  
  <pre><code>public class Item extends Object {
  private String Data= null;
  Item()  {
  
  }
  Item(String data) {
      this.Data = data;
  }
  public void setData(String data) {
      this.Data = data;
  }
  public String getData() {
      return this.Data;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>RSSHandler.java</p>
  
  <pre><code>public class RSSHandler extends DefaultHandler {
  public static final String ITEMS_TABLE="items";
  private final String MY_DEBUG_TAG = "handler";
  boolean inChannel = false;
  public Item item;
  LearDB leardb = null;
  RSSHandler(Context context)
  {
      leardb = new LearDB(context);
      item =new Item();
  }
  @Override
  public void startDocument() throws SAXException {
      this.item = new Item();
  }  
  @Override
  public void endDocument( ) throws SAXException{
  }  
  
  @Override
  public void startElement(String Uri, String localName, String qName, 
          Attributes atts) throws SAXException { 
      if (localName.equals("channel")) {
          this.inChannel = true;
      }
      else {
          return;
      }
  }
  @Override
  public void endElement(String Uri, String localName, String qName) 
  throws SAXException {
      if (localName.equals("channel")) {
          this.inChannel = false;
      }
      else {
          return;
      }
  } 
  @Override
  public void characters(char ch[], int start, int length) {
      String temp = new String(ch, start, length);
      try {
          if (this.inChannel) {
              this.item.setData(temp);
          }
      }   catch (Exception e) {
          Log.e(MY_DEBUG_TAG, "Parsing Error", e);
      } 
  }
  public String getData() {
      return this.item.getData();
  
  }
  public Item getItem() {
      return this.item;
  }    
  public void insertItem(String temp) {
      SQLiteDatabase db = leardb.getWritableDatabase();
      ContentValues value=new ContentValues();
      value.put("data", temp);
      db.insert(ITEMS_TABLE, null, value);        
  }
  </code></pre>
  
  <p>}</p>
  
  <p>LearDB.java</p>
  
  <pre><code>public class LearDB extends SQLiteOpenHelper {
  private static final String DATABASE_NAME="lear.db";
  public static final String ITEMS_TABLE="items";
  
  public LearDB(Context context) {
      super(context, DATABASE_NAME, null, 1);     
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
      String sql = ("CREATE TABLE items (_id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);");
      db.execSQL(sql);    
  }
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      if (oldVersion == 1 &amp;&amp; newVersion == 2) {
          String sql = "drop table items;";
          db.execSQL(sql);
          sql = ("CREATE TABLE items (_id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);");
          db.execSQL(sql);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>main activity</p>
  
  <pre><code>public class test3 extends Activity {
  private final String MY_DEBUG_TAG = "test2";
  @Override
  public void onCreate(Bundle icicle) {
      super.onCreate(icicle);
      TextView text = new TextView(this);
      try {
          URL url = new URL("http://achdre.freehostia.com/example.xml");// URL of XML document to be parsed
          InputSource source = new InputSource(url.openStream());
          SAXParserFactory LearParseFactory = SAXParserFactory.newInstance();
          SAXParser LearParser = LearParseFactory.newSAXParser(); //SAX Parser object
          XMLReader LearReader = LearParser.getXMLReader(); // Object that scans the XML document
          RSSHandler LearHandler = new RSSHandler(this); //Handler object
          LearReader.setContentHandler(LearHandler);
          LearReader.parse(source); //Parses the XML document
          String temp=LearHandler.getData();
          text.setText("12345");
          LearHandler.insertItem("android"); //inserting test string to DB
          } 
      catch (Exception e) {
          text.setText("Error: " + e.getMessage());
          Log.e(MY_DEBUG_TAG, "Parsing Error", e);
          } 
      this.setContentView(text);
  }}
  </code></pre>
  
  <p>and the manifest file</p>
  
  <pre><code>&lt;uses-sdk android:minSdkVersion="8" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
  &lt;application android:icon="..." android:label="..."android:debuggable="true"&gt;
  &lt;activity android:name=".test3"android:label="@string/app_name"&gt;
  &lt;intent-filter&gt;
  &lt;action android:name="android.intent.action.MAIN" /&gt;
  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
  &lt;/intent-filter&gt;
  &lt;/activity&gt;
  &lt;/application&gt;
  android:label="@string/app_name"android:debuggable="true"&gt;
  </code></pre>
  
  <p>edit: I managed to make it run. errors were both on the xml I was trying to parse and on my handler class callback events. no need for more assistance</p>