/*
 * MIDBench.java
 *
 * Created on February 26, 2003, 4:07 PM
 */

package MIDBench;

import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 *
 * @author  Administrator
 * @version
 */
public class MIDBenchReaderrss extends javax.microedition.midlet.MIDlet {

    private static void testReaderSetup(String s) {
        ByteArrayInputStream bin = 
            new ByteArrayInputStream(s.getBytes());
        new InputStreamReader(bin);
    }
    
    private Form form;
    public void startApp() {
        String output = "Parsing done!";
        try {
            for (int i = 0; i < 5; i++ ) {
        testReaderSetup("<?xml version=\"1.0\"?>\n" +
                 "<!DOCTYPE rss PUBLIC\n" +
                 "  \"-//Netscape Communications//DTD RSS 0.91//EN\"\n" + 
                 "  \"http://my.netscape.com/publish/formats/rss-0.91.dtd\"\n" +
                 ">\n" +
                 "<rss version=\"0.91\">\n" +
                 "  <channel>\n" + 
                 "    <title>Meerkat: An Open Wire Service</title>\n" +
                 "    <link>http://meerkat.oreillynet.com</link>\n" +
                 "    <description>\n" +
                 "      Meerkat is a Web-based syndicated content reader \n" +
                 "      providing a simple interface to RSS stories.  While\n" +
                 "      maintaining the original association of a story with\n" +
                 "      a channel, Meerkat's focus is on chronological\n" +
                 "      order -- the latest stories float to the top,\n" +
                 "      regardless of their source.\n" +
                 "    </description>\n" +
                 "    <language>en-us</language>\n" +
                 "    <image>\n" +
                 "      <title>Meerkat Powered!</title> \n" +
                 "      <url>\n" +
                 "      http://meerkat.oreillynet.com/icons/meerkat-powered.jpg\n" +
                 "      </url>\n" +
                 "      <link>http://meerkat.oreillynet.com</link> \n" +
                 "      <width>88</width> \n" +
                 "      <height>31</height> \n" +
                 "      <description>Visit Meerkat in full splendor at\n" +
                 "          meerkat.oreillynet.com...</description> \n" +
                 "    </image> \n" +
                 "    <item>\n" +
                 "      <title>MmO2 cuts jobs, to take GBP110m charge</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31561327\n" +
                 "          </link>\n" +
                 "      <description>FTMarketWatch Feb 5 2002 5:05AM ET...\n" +
                 "          </description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>S.E.C. Says Motorola Cant Exclude Audit\n" +
                 "          Proposal</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31562096\n" +
                 "          </link>\n" +
                 "      <description>New York Times Feb 5 2002 5:17AM ET...\n" +
                 "          </description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>1,900 jobs to go at mmO2</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31562134\n" +
                 "          </link>\n" +
                 "      <description>ZDNet Feb 5 2002 5:18AM ET..\n" +
                 "          </description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>Mobile firm cutting 1,900 jobs</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31558750\n" +
                 "          </link>\n" +
                 "      <description>CNN Europe Feb 5 2002 4:30AM ET...\n" +
                 "          </description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>The axe falls at mmO2</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31558856\n" +
                 "          </link>\n" +
                 "      <description>The Register Feb 5 2002 4:32AM ET...\n" +
                 "          j</description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>mmO2 plans to axe 1,900 jobs</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31559617\n" +
                 "          </link>\n" +
                 "      <description>Evening Standard Feb 5 2002 4:42AM ET...\n" +
                 "          </description>\n" +
                 "    </item>\n" +
                 "    <item>\n" +
                 "      <title>UPDATE 2-Sohu Q4 revenues up 15 pct on wireless\n" +
                 "          services</title>\n" +
                 "      <link>http://c.moreover.com/click/here.pl?r31557811\n" +
                 "          </link>\n" +
                 "      <description>CNET Feb 5 2002 4:08AM ET...</description>\n" +
                 "    </item>\n" +
                 "  </channel>\n" +
                 "</rss>");
            }
        } catch (Exception e) {
            output = "Parsing failed!";
        }
        form = new Form("Done");
        form.append(new StringItem(null, output));
        Display.getDisplay(this).setCurrent(form);
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
}
