wyodrębnij wielokrotne tabele html za pomocą hxt
mój problem polega na tym, że muszę wyodrębnić wszystkie tabele z dokumentu HTML i umieścić je na liście tabel.
Dlatego rozumiem, że końcowy typ funkcji powinien być
getTable :: a [XmlTree] [[String]]
na przykład za pomocą następującego pliku xml:
<table class="t1">
<tr>
<td>x</td>
<td>y</td>
</tr>
<tr>
<td>a</td>
<td>b</td>
</tr>
</table>
<table class="t2">
<tr>
<td>3</td>
<td>5</td>
</tr>
<tr>
<td>toto</td>
<td>titi</td>
</tr>
</table>
Wiem, jak pobrać wszystkie wiersze z jednego xmlTree (example1) lub wszystkich tagów „tabel”, które zapewniają mi typ [XmlTree], ale nie wiem, jak zmapować strzałkę example1 wewnątrz wyniku testu2.
Jestem pewien, że to oczywiste, ale nie mogę go znaleźć.
test2 :: IO [[XmlTree]]
test2 = runX $ parseXML "table.xml" >>> is "table">>> listA getChildren
example1 :: ArrowXml a => a XmlTree [String]
example1 = is "table" /> listA (getChildren >>> is "td" /> getText)