2014-04-13 4 views
0

Jsoup와 구문 분석 할 HTML이 있으며 HTML의 이상한 구조가 뒤 따른다.중첩 된 HTML 용 Jsoup 구문 분석

<html> 
    <body class="page3078"> 
    <div id="mainCapsule"> 
     <div id="contentCapsule" class="capsule"> 
     <div id="content"> 
      <div id="subCapsule" class="clearFix" xmlns=""> 
      <div id="contentLeft"> 
       <iframe width="635" height="1000" frameborder="0" src="apps/Results.aspx"> 
       #document 
       <html xmlns="http://www.w3.org/1999/xhtml"> 
        <body style="background:none;"> 
        <form id="form1" action="Results.aspx" method="post" name="form1"> 
         <div class="pressContent"> 
         <div class="tableCapsule details"> 
          <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
          <tbody> 
           <tr class="even"> 

은 기본적으로 내가 클래스와 태그의 내부에 "도"를 텍스트를 얻으려면 :이 같은 HTML을 (모든 라인은 위의 안쪽에 한 단계) 요약 할 수 있습니다. 다음과 같이 직접 클래스를 호출 해 보았습니다.

doc.getElementsByClass("even") 

작동하지 않았습니다. 내가 선택기 방법과 부모> 자식 관계를 시도. 그것도 작동하지 않았다. 두 번째 html 태그 내부에서 시도했습니다.

doc.select("body.page3078 > html > body > #form1 > th"); 

작동하지 않았습니다. 내가 어디서 잘못한거야?

+3

언급 한 바와 같이 [여기] (http://stackoverflow.com/questions/16234019/traverse-iframe-using-jsoup) 별도의 jsoup 파서에 iframe이에서 페이지를 얻을 필요가있다. 이 페이지는별로 이상하지 않습니다. 단지 별도의 페이지가 iframe에 표시됩니다. –

답변

0

한 의견은 여기에 솔루션의 시작을 요약

여기에 언급 별도의 jsoup 파서에 iframe 대응의 페이지를 얻을 필요로

. 이 페이지는별로 이상하지 않습니다. 단지 별도의 페이지가 iframe에 표시됩니다. - Boris the Spider