안드로이드 개발 질문/답변
(글 수 45,052)
HtmlCleaner예제를 이용해서 해보고있습니다..
테그에 있는정보를 뽑아오고싶은데요..
TextView tv = (TextView) findViewById(R.id.TextView01);
HtmlCleaner cleaner = new HtmlCleaner();
CleanerProperties props = cleaner.getProperties();
props.setOmitComments(true); //주석제거
try{
TagNode node = cleaner.clean(Url);
Object[] objArray = node.evaluateXPath(
"//table//tr//td//a[@href=read.php?id=12&no=0&field=&search_word=]");
for (Object obj: objArray) {
TagNode t = (TagNode)obj;
tv.setText(t.getText().toString());
}
}catch(IOException e ){
e.printStackTrace();
}catch (XPatherException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
뽑아와서 텍스트뷰에 넣고싶은데요.. 계속 못가져오네요..원인이뭔지..ㅠ
html은
<body>
<div id="skipnavigation">
<a href="">콘텐츠 바로가기</a>
</div>
<hr />
<div>
<div id="header">
<h1 class="hs"><img src="../image/top_title_notice.jpg" width="75" height="21" /></h1>
</div>
<br/> <a href="../member/logout.php">로그아웃</a>
<a href="../member/list.php">회원관리</a>
<div>
<ul id="hs_notice">
<table width=100% border=0 cellpadding=0 cellspacing=0 >
<tr height="30">
<td height=20 bgcolor=white align=center width="5%">
<a href=read.php?id=12&no=0&field=&search_word=>12</a>
</td>
<!-- 번호 끝 -->
<!-- 제목 -->
<td height=20 bgcolor=white >
<a href=read.php?id=12&no=0&field=&search_word=>
안녕하세요</a>
</td>
이부분을 뽑아오고싶은데 안오네요..
어디가 문제가 있는건가요??소스전체가 잘못됐나요?
테그에 있는정보를 뽑아오고싶은데요..
TextView tv = (TextView) findViewById(R.id.TextView01);
HtmlCleaner cleaner = new HtmlCleaner();
CleanerProperties props = cleaner.getProperties();
props.setOmitComments(true); //주석제거
try{
TagNode node = cleaner.clean(Url);
Object[] objArray = node.evaluateXPath(
"//table//tr//td//a[@href=read.php?id=12&no=0&field=&search_word=]");
for (Object obj: objArray) {
TagNode t = (TagNode)obj;
tv.setText(t.getText().toString());
}
}catch(IOException e ){
e.printStackTrace();
}catch (XPatherException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
뽑아와서 텍스트뷰에 넣고싶은데요.. 계속 못가져오네요..원인이뭔지..ㅠ
html은
<body>
<div id="skipnavigation">
<a href="">콘텐츠 바로가기</a>
</div>
<hr />
<div>
<div id="header">
<h1 class="hs"><img src="../image/top_title_notice.jpg" width="75" height="21" /></h1>
</div>
<br/> <a href="../member/logout.php">로그아웃</a>
<a href="../member/list.php">회원관리</a>
<div>
<ul id="hs_notice">
<table width=100% border=0 cellpadding=0 cellspacing=0 >
<tr height="30">
<td height=20 bgcolor=white align=center width="5%">
<a href=read.php?id=12&no=0&field=&search_word=>12</a>
</td>
<!-- 번호 끝 -->
<!-- 제목 -->
<td height=20 bgcolor=white >
<a href=read.php?id=12&no=0&field=&search_word=>
안녕하세요</a>
</td>
이부분을 뽑아오고싶은데 안오네요..
어디가 문제가 있는건가요??소스전체가 잘못됐나요?