안녕하세요
android를 시작한지 얼마안되는 학생입니다 :)
개인적인 프로젝트를 진행하구 있는데 계속 html 파싱이 안되네요 ㅠㅠ
컴퓨터에서 html 소스보기한거랑 안드로이드에서 파싱된 결과를 로그로 찍어본거랑
달라요 ㅠㅠ
어디가 잘못된건가요,
어떻게 해야 제대로된 소스를 가지고 올수있을까요 ㅠ 도와주세요
try{
URL url = new URL(feedUrl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int responseCode = httpConnection.getResponseCode();
if(responseCode == HttpURLConnection.HTTP_OK){
InputStream input = httpConnection.getInputStream();
int len = -1;
byte b[] = new byte[64000];
StringBuffer sb = new StringBuffer();
while ((len = input.read(b, 0, b.length)) > 0)
sb.append(new String(b, 0, len));
input.close();
return sb.toString();
}
} catch(Exception e){
e.printStackTrace();
}