2011-07-04 12 views
2

を取得し、私はURLからXMLコンテンツを取得しようとしている:私は応答内容を書き出すときWebコンテンツ

HttpClient client = new DefaultHttpClient(); 
HttpGet request = new HttpGet(); 
request.setURI(new URI("http://www.domain.com/test.aspx")); 
HttpResponse response = client.execute(request); 
in = response.getEntity().getContent(); 

、これはコンテンツの終了前に切り捨てられます。

答えて

1

入力ストリームにはを使用しましたか?in

String s = ""; 
String line = ""; 
BufferedReader rd = new BufferedReader(new InputStreamReader(in)); 
try { 
    while ((line = rd.readLine()) != null) { s += line; } 
} catch (IOException e) { 
    // Handle error 
} 

// s should be the complete string 
+0

私はDocumentBuilderクラスの入力ストリームto解析​​メソッドを渡します。 – alfdev

0

多分私は解決している、アンドロイドエミュレータでした。単にそれを再起動するだけで正常に動作します。

ありがとうございました