@Override
  public void endElement(String uri, String localName, String qName) throws SAXException {
    super.endElement(uri, localName, qName);

    if (localName.equals("item")) {
      stories.add(story);
      story = null;
      largestImgWidth = 0;
    }
    if (story != null) {
      if (localName.equals("title")) {
        story.setTitle(xmlInnerText.toString().trim());
      } else if (localName.equals("description")) {
        story.setDescription(xmlInnerText.toString().trim());
      } else if (localName.equals("link")) {
        story.setLink(xmlInnerText.toString().trim());
      } else if (localName.equals("pubDate")) {
        SimpleDateFormat dtSourceFormat = story.getSourceDateFormater();
        SimpleDateFormat dtTargetFormat = story.getTargetDateFormater();

        try {
          story.setPubDate(dtSourceFormat.parse(xmlInnerText.toString().trim()));
        } catch (ParseException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        Log.d("Exam01", "Parsed date : " + dtTargetFormat.format(story.getPubDate()));
      }
      xmlInnerText.setLength(0);
    }
  }
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {
    super.startElement(uri, localName, qName, attributes);
    if (localName.equals("item")) {
      story = new NewsStory();
      Log.d("Exam01", "Entering item element");
    } else if (localName.equals("title")) {
      xmlInnerText.setLength(0);
    } else if (localName.equals("thumbnail")) {
      int width = Integer.parseInt(attributes.getValue("width"));

      storyUrl = attributes.getValue("url");

      if (width > this.largestImgWidth) {
        largestImgWidth = width;
        story.setUrl(storyUrl);
      }
    }
  }