Best practices retrieving XML/stream from HTTP in Android

Posted by Jeffrey on Stack Overflow See other posts from Stack Overflow or by Jeffrey
Published on 2010-05-04T17:20:04Z Indexed on 2010/05/04 17:38 UTC
Read the original article Hit count: 298

Filed under:
|
|
|
|

Hello everyone, what are the best practices parsing XML from an HTTP resource in Android? I've been using HttpURLConnection to retrieve an InputStream, wrapping it with a BufferedInputStream, and then using SAX to parse the buffered stream. For the most part it works, though I do receive error reports of SocketTimeoutException: The operation timed out or general parsing error. I believe it's due to the InputStream.

  1. Would using HttpClient instead of HttpURLConnection help? If yes, why?
  2. Should the stream be output to a file, having the file parsed instead of the stream?

Any input or direction would be greatly appreciated. Thanks for your time.

© Stack Overflow or respective owner

Related posts about android

Related posts about Xml