What's the best way to perform case-insensitive tag and attribute name matching using xml-conduit?
For example, consider the findNodes function from the HTML parsing example on FP Complete's School of Haskell:
-- The data we're going to search for
findNodes :: Cursor -> [Cursor]
findNodes = element "span" >=> attributeIs "class" "sb_count" >=> child
(I've modified this line to that it will work with the Bing's current page structure.)
My experiments indicate that element and attributeIs do not perform case-insensitive comparisons when matching names. Is there an easy way to change this?
You can use laxElement to ignore case when matching elements. It will also ignore namespaces. It should be pretty easy to write a wrapper around
checkNamethat has the exact semantics you're looking for.