[Haskell-cafe] Problem with HXT `when`
vlatko.basic at gmail.com
Sat Sep 21 11:13:48 CEST 2013
I have this HTML structure:
<a href="...">Want this</a>
<a href="...">And this</a>
<th>Yet another caption</th>
I'd like to extract A texts from row with header "Caption", and have come up
runX $ doc
>>> (deep (hasName "tr") -- filter
>>> withTraceLevel 5 traceTree -- shows correct TR
hasName "th" >>> --
filter THs with specified text
getChildren >>> hasText (=="Caption")
) -- inner deep
>>> getChildren >>> hasName "td" -- shouldn't here be only one TR?
>>> getName &&& (getChildren >>> getText) -- list has TDs from all
Tried with `guards` but getting the same result.
I know there are other packages that might solve this in another way, but I'd
like to understand what is going on here.
More information about the Haskell-Cafe