2013-05-11 18 views
-1

我正在製作一個android應用程序以從rss訂閱源獲取數據http://pipes.yahoo.com/pipes/pipe.run?_id=be43f7366c8bae3b485cce84308d7abf&_render=rss&jumlah=50&location=indonesia 任何人都可以請建議一個想法,從RSS與XML中獲取數據?如何使xml編程

+1

請參閱本學習XML解析:HTTP:/ /xstream.codehaus.org/tutorial.html – Shrikant 2013-05-11 06:19:08

+0

感謝您的回放。但在使用java的xtream中。我使用xml(作爲客戶端)從RSS服務器獲取數據(http://pipes.yahoo.com/pipes/pipe.run?_id=be43f7366c8bae3b485cce84308d7abf&_render=rss&jumlah=50&location=indonesia)。你能幫我嗎? – faraindo 2013-05-11 07:02:00

+0

我沒有得到你的問題..你能詳細說明嗎? – Shrikant 2013-05-11 07:05:57

回答

0

我個人比較喜歡XMLPullParser,尤其是對於更復雜的XML文件:http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html

爲了讓XML文件在Java代碼中使用這樣的:

URL url = new URL("http://pipes.yahoo.com/pipes/pipe.run?_id=be43f7366c8bae3b485cce84308d7abf&_render=rss&jumlah=50&location=indonesia"); 
URLConnection httpConn = url.openConnection(); 
InputStream in = httpConn.getInputStream(); 
MyXMLPullParser parser = new MyXMLPullParser(); 
parser.parse(in);