开发者

Reading XML from the web in Java

I have a given URL with specific IDs. I'm suppose to pass those IDs to thi开发者_如何学Gos URL as argument and retrieve the XML in java. Any clue?


You can go ahead by opening creating http connection, opening stream and reading data. After you can parse you xml data. Not that sure this is what you need.. Provide us with more details.


Android uses HttpClient. You can create simple GET with parameters.

For parsing XML you have both DOM and SAX parser on Android.

DOM reads whole document in memory and lets you manipulate it: examples

SAX is stream oriented and is more usable on large XML documents where you would like to just get specific elements/attributes: examples


I would also recommend using this for XML functionality, XmlPullParser.

XmlPullParser newPullParser = Xml.newPullParser();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜