How the jQuery selector mechanism works (approximately), the existing Javascript DOM-selection / manipulation code is used. As far as I know, no one has created something similar in Haskell and probably not without reason. This is easy to do with Javascript because of the DOM and existing functionality, but in Haskell you have neither much need nor for it to be especially easy.
However, if you write it yourself, you will simply do a lot of nasty XML parsing. If you can put away the page in XHTML, you can parse it as XML; then you can choose based on if the node has children, if the node has this attribute, what the element itself is, and so on.
Maybe you're just looking for an XML library! If this works for you, I would recommend HaXml. I used it two more times, but I liked it. However, nothing special in this application.
Anthony
source share