Reputation: 1591
I have the following same code....
<a id="rowID5" class="title-link">
<div id="rowData">
<div>Some text here</div>
</div>
</a>
Now i HAVE to do a select off the "a" element using the following code...
Document doc = Jsoup.parse(htmlData);
Elements row = doc.select("a.title-link");
Now when I do the following...
for (int i = 0; i < row.size(); i++){
String foo = row.get(i).html();
break; //I break here only for Testing Purposes there will be more rows eventually
}
The problem is of course is when "foo" is returned it's equal to...
<div id="rowData">
<div>Some text </div>
</div>
I need "foo" to equal the original which is..
<a id="rowID5" class="title-link">
<div id="rowData">
<div>Some text here</div>
</div>
</a>
The reason why I'm doing all of this is because I do a select on the document to return the inner html of the element. My code then extracts the data from within the element and does things (where foo string is created) then I need to take the full html (including the A tag element and it's children) and set it equal to "foo" as the output.
Upvotes: 0
Views: 1716