0

I have an HTML to parse with Jsoup and I lose track after the HTML's weird structure. I can summarize HTML like this(Every line is one level inside of the above):

<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">

Basically I want to get text inside of the tag with class "even". I tried directly calling class even like this:

doc.getElementsByClass("even")

It didn't work. I tried parent > child relationship with selector method. It didn't work either. I tried this inside of second html tag:

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

Didn't work either. Where am I wrong?

Biffen
  • 6,249
  • 6
  • 28
  • 36
brainmassage
  • 1,234
  • 7
  • 23
  • 42
  • 3
    As mentioned [here](http://stackoverflow.com/questions/16234019/traverse-iframe-using-jsoup) you need to get the page from the iframe in a separate jsoup parser. This page isn't weird at all - it's just a separate page is shown in the iframe. – Boris the Spider Apr 13 '14 at 08:25

1 Answers1

1

One comment summarizes the start of a solution here:

As mentioned here you need to get the page from the iframe in a separate jsoup parser. This page isn't weird at all - it's just a separate page is shown in the iframe. – Boris the Spider

Community
  • 1
  • 1
Stephan
  • 41,764
  • 65
  • 238
  • 329