Info

public void startElement(java.lang.String namespaceURIjava.lang.String localNamejava.lang.String qName.Attributcs atts) throws SAXException

71-,%m\im, »mmhcmA^wm Muri. /en«»,

12 M Android --RSS KliHSS^ft]

£ ifc

7& itt

public void endElement(java.lang.String namespaceURI, java.lang.String localNamc, java.lang.String qName) throws SAXException

Itturi.

public void characters(char[ | ch, int start, int length) throws SAXException

&MX.MM'Yttt^ # & <I'»iW&&^J7?

afflff^ffl- K org.xml.sax.XMI. Reader AtiSI^A W^Ptft fJi/fNo

£ ft

■n * ^ *s

Public void sctContentHandlcr(Comentl landlcr handler)

i i M&S! XML A:^irt '#i?rr^#WContcntHandler

public void parse( InputSourcc input)throws java.io.IOF.xccption.SAXKxccption

WftWr XML

X; fJtiWjttfflW f Mj iVMW HUML

12.3.1 RSS l^itS^HtiSit rssi$M£» ■ntmLGMW (-, )ksm l:Uktefcfc*$tW. kiiilM^fcLt&if ^ RSS wfeed, ^/nWriitfced, jmrn^wi^, vmmiBR&^K*

12.3.2 RSS ¡mm ui reedMrt??, 'j'j^b ^/u^ififflrt^o

1. iijfttiti^s fi^/ei^wfiti^iBiipra 12-1 m>

RSS ISIiiS&iai+

. ^fci'frenturebeatgM-flj;»*« . \ftAndroi d#W£98l7B*SJ8N±llf£±7î5, Android^

-t RSS RSS M-^Mmimwk&m itemim KJ&M rss mwiïo

• description, ft'i ffi& « (2) item Siiti^WfHEW:

<?xml vers±on="1.0" encoding="UTF-8M?>

<RSS version="2 .0" xmlna : content = "http://purl. org/R5S/l . 0/moduies/cor.t prit /" xmlns : i tunes ="http://www.itunes.com/dtds/podcast-1.O.dtd"

0**3757mTC*^20l3!Androi dtöffi

GoogleMtfcAndroidtfJg

IS^iphone 1.02 âlft

. ^fci'frenturebeatgM-flj;»*« . \ftAndroi d#W£98l7B*SJ8N±llf£±7î5, Android^

rss Ki^sw^ia xmlnsrdc "http://purl.0rg/dc/element5/l. 1/"

xmlns:t rackback="http://madskills.com/public/xmi/RSS/module/trackback/"> <channel>

<title>Haiyang I Focus on Android</title> <link>http://rubyjin.cn</link>

<description>focus on Android and startup</description> <it;.em>

<1 ink>http://rubyj in.cn/blog/show/17</link>

<description>i£M-f&ii£fiIS< /descript ion>

<pubDate>Tue, 23 Sep 2008 06:26:54 -0700</pubDate>

AM«? RSS mmm. mm^vxmmiifiMfSj&*wrrtiktm^wxaa. mm»i■

RSSFeed 3<S:

package com.RSS reader.data; impor t java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector;

public class RSSFeed \

private String title = null; private String pubdate = null; private ir.t it.emco.unt = 0; private List<RSSItem> itemlist; public RSSFeed(> I

public int adaltem(RSSIt em item) {

itemlist.add(i tem); itemcount+ +■; return itemcount; 1

public RSSltem getltem(int location) i return itemlist.get(location) ; )

public List getAHItemsO {

return itemlist; )

public List getAHI temsForList.View () |

List<Map<String, Object>> data = new ArrayList<Map<String, Object»(); int size - itemlist.size 0; for{int i=0;i<size;i + +)\

HashMap<String, Ob ject> item new HashMap<String, Object>(); item.put(RSSltem.TITLE, itemlist.get(i). getTitleO);

item.put(RSSItem.PUBDATE, itemlist.get(i).getPubDate() ) ; data. add (item.) ; )

return data; )

int getltemCount() i return itemcount; }

public void setTitle(String title) <

public void setPubDate(String pubdate) {

this.pubdate = pubdate; }

public String getTitleO {

return title; )

public String getPubDate() {

return pubdate;

• add Item JjU<1A ïïft ^ RSSItem 1)[\ Ai"J RSSFeed 3S SJ&,

• getAHItemsForListView ¿ÎÉftïrM RSSFeed ^Mii^^c^J^ (ListView)

RSSItem package com.RSS reader.data;

public class RSSItem (

public static final String TITLE="title";

public static final String PUBDATE="pubdate";

private String title = nulls-

private String description = nulls-

private String link = nulls-

private String category = null;

private String pubdate = nulls-

public void setTitle(String title) {

public- void setDescript îor. (St ri r.g description)

this.description = description;

public: void setLink (St r ing link) {

public void setCategory(String category)

this.category = category; )

public void setPubDate(String pubdate) (

this.pubdate = pubdate; )

public String getTitleO I

return title; }

public String getDescription() {

return description; )

public String getLink() {

return link;

public String getCategory() {

return category; )

public String getPubDateO {

return pubdate; )

public String toStringO (

return title; }

0 0

Post a comment