Lets say I copy a complete HTML table (when each and every tr and td has extra attributes)
into a String. How can I take all the contents (what is between the tags) and create an 2D array that is organized like the original table?
For example for this table:
<table border="1">
<tr align= "center">
<td align="char">TD1</td>
<td>td1</td>
<td align="char">TD1</td>
<td>td1</td>
</tr>
<tr>
<td>TD2</td>
<td>tD2</td>
<td class="bold>Td2</td>
<td>td2</td>
</tr>
</table>
I want this array:

PS: I know I can use regex but it would be extremely complicated. I want a tool like JSoup that can do all the work automatically without much code writing
This is how it could be done using JSoup (srsly, don’t use regexp for HTML).
Also, the
classattribute value is not closed properly here in your example:it should be