2011-07-04 147 views
2

我試圖讓從URL XML內容:當我寫出來的響應內容獲取網絡內容

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

您是否使用InputStreamReader作爲輸入流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類的解析方法。 – alfdev

0

也許我已經解決了,是android模擬器。只需重新啓動它一切正常。

感謝所有