WEB开发网
开发学院手机开发Android 开发 Android xml读写 阅读

Android xml读写

 2010-05-31 14:32:00 来源:WEB开发网   
核心提示:static final String TITLE = "title";static final String ITEM = "item";final URL feedUrl;protected BaseFeedParser(String feedUrl){try {this.f

static final String TITLE = "title";

static final String ITEM = "item";

final URL feedUrl;

protected BaseFeedParser(String feedUrl){

try {

this.feedUrl = new URL(feedUrl);

} catch (MalformedURLException e) {

throw new RuntimeException(e);

}

}

protected InputStream getInputStream() {

try {

return feedUrl.openConnection().getInputStream();

} catch (IOException e) {

throw new RuntimeException(e);

}

}

}

基类存储 de >feedUrlde > 并使用它打开了一个 de >java.io.InputStreamde >。如果出现任何差错,它会抛出一个 de >RuntimeExceptionde >,造成应用程序出现故障。基类还为标记的名称定义了一些简单的常量。清单 4 显示了提要中的一些示例内容,以便于您理解这些标记的重要性。

清单 4. 示例 XML 提要

< ?xml version="1.0" encoding="UTF-8"? >

< !-- generator="FeedCreator 1.7.2" -- >

< rss version="2.0" >

< channel >

< title >android_news< /title >

< description >android_news< /description >

< link >http://www.androidster.com/android_news.php< /link >

< lastBuildDate >Sun, 19 Apr 2009 19:43:45 +0100< /lastBuildDate >

< generator >FeedCreator 1.7.2< /generator >

< item >

< title >Samsung S8000 to Run Android, Play DivX, Take Over the

World< /title >

< link >http://www.androidster.com/android_news/samsung-s8000-to-run-android-

play-divx-take-over-the-world< /link >

< description >More details have emerged on the first Samsung handset

to run Android. A yet-to-be announced phone called the S8000 is being

reported ...< /description >

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Android xml 读写

编辑录入:coldstar [复制链接] [打 印]
赞助商链接