Android Open Source - AndroidDev Rss Handler

From Project

Back to project page AndroidDev.


The source code is released under:

GNU General Public License

If you think the Android project AndroidDev listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

import java.util.ArrayList;
import java.util.List;
/*  w  w w .j  av  a  2 s .  c  om*/
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import static*;

public class RssHandler extends DefaultHandler{
  private List<Message> messages;
  private Message currentMessage;
  private StringBuilder builder;
  public List<Message> getMessages(){
    return this.messages;
  public void characters(char[] ch, int start, int length)
      throws SAXException {
    super.characters(ch, start, length);
    builder.append(ch, start, length);

  public void endElement(String uri, String localName, String name)
      throws SAXException {
    super.endElement(uri, localName, name);
    if (this.currentMessage != null){
      if (localName.equalsIgnoreCase(TITLE)){
      } else if (localName.equalsIgnoreCase(LINK)){
      } else if (localName.equalsIgnoreCase(DESCRIPTION)){
      } else if (localName.equalsIgnoreCase(PUB_DATE)){
      } else if (localName.equalsIgnoreCase(ITEM)){

  public void startDocument() throws SAXException {
    messages = new ArrayList<Message>();
    builder = new StringBuilder();

  public void startElement(String uri, String localName, String name,
      Attributes attributes) throws SAXException {
    super.startElement(uri, localName, name, attributes);
    if (localName.equalsIgnoreCase(ITEM)){
      this.currentMessage = new Message();

Java Source Code List