
On Mon, Jul 11, 2011 at 8:42 AM, Michael Xavier
Hi Cafe. I'm writing a library which will be parsing XML data from a web API. I'm fairly well versed at this point in parsing JSON (aeson being my library of choice). For XML, I like the API of xml-enumerator over hxt because it appears to be nice and simple .The problem is that the example in the documentation isn't really sufficient for me to get a grasp of how to traverse XML and parse elements with multiple child nodes into a record. My first question: Am I barking up the wrong tree using xml-enumerator for anything beyond fairly flat, basic XML? If not, can anyone direct me to some good code samples using xml-enumerator to parse more complicated data? If I am indeed barking up the wrong tree, what would you all suggest? Thanks,
I think you're not barking up the wrong tree. I use xml-enumerator extensively for some internal XML parsing, and some of it is very complicated. Unfortunately, I can't share that code ;). However, there are a few examples out there of some significant XML parsing: https://github.com/snoyberg/yesodwiki/blob/master/Handler/UploadDitamap.hs https://github.com/aristidb/aws (Aristid would have more info here) I would recommend using either the Cursor or Resolved modules for development, unless you really need more control over unresolved entities. As a side point, I was just thinking this morning that I should really write a tutorial on xml-enumerator. If you have some specific questions, please pass them on, maybe I'll put together a cookbook. Michael