-1
I am parsing a table. But within this table there is another table and it is difficult to find the whole elements. I’ll paste the code to illustrate it better.
<table>
<tr>
<td>
Dados Gerais
</td>
</tr>
<tr>
<td>
<div>Dados de Nomes</div>
</td>
<td>
<table>
<tr>
<td>
Nome
</td>
</tr>
<tr>
<td>
João da Silva
</td>
</tr>
<tr>
<td>
Maria da Silva
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div>Dados de Técnicos</div>
</td>
<td>
<table>
<tr>
<td>
Data
</td>
</tr>
<tr>
<td>
10/09/2019
</td>
</tr>
<tr>
<td>
11/09/2019
</td>
</tr>
</table>
</td>
</tr>
I do the find dos tr it returns all tr
$trs = $tabela->find('tr');
But I would like him to ignore the three that are within the table that is within the table.
---------- Edited question ----------
Well, I did a foreach to count how many trs were inside the table and found the exact amount of trs. Example below.
$contar = $tabela->find('tr');
$c=0;
foreach ($contar as $k) {
$c++;
}
$trCorreto = $trs[$c];
Not because I don’t want the first tr, I want the third tr where you have the "Technical Data"
– Fernando Issler
I posted the solution I got
– Fernando Issler
Wow, but then you’re doing something completely different from what you asked and commented on. Re-read your question and see that the solution you put -- which is wrong, because the question field is only for "the question"-, is totally alien to the solution you put.
– Sam
It’s no different! I just used a parallel solution. I wanted him to ignore the TR inside the second TR. What I did was count the TR inside the second TR to skip them when I loop. Which is the same. I understand that this is not the best solution or the official solution, but it solved the problem.
– Fernando Issler