Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Haskell XML library to use?

I see that there is a few of XML processing libraries in Haskell.

  • HaXml seems to be the most popular (according to dons)
  • HXT seems to be the most advanced (but also the most difficult to learn thanks to arrows)
  • xml which seems to be just the basic parser
  • HXML seems to be abandoned
  • tagsoup and tagchup
  • libXML and libXML SAX bindings

So, which library to choose if I want it

  • to be reasonably powerful (to extract data from XML and to modify XML)
  • likely to be supported long time in the future
  • to be a “community choice” (default choice)

And while most of the above seem to be sufficient for my current needs, what are the reason to choose one of them over the others?

UPD 20091222:

Some notes about licenses:

  • BSD or MIT: hexpat, hxt, libxml, tagsoup, xml
  • LGPL: HaXml
  • GPLv2:
  • GPLv3: libxml-sax, tagchup, tagsoup-ht
like image 495
sastanin Avatar asked Sep 01 '09 08:09

sastanin


2 Answers

I would recommend:

  1. xml, if your task is simple
  2. haxml, if your task is complex
  3. hxt, if you like arrows
  4. hexpat if you need high performance
like image 155
Don Stewart Avatar answered Sep 20 '22 21:09

Don Stewart


HXT's main problem, aside from the unusual arrow syntax, is performance and memory usage. I have an app that spends 1.2 seconds processing about 1.5MB of XML, consuming about 2.3GB (!) of memory in the process. Libxml2 takes a few milliseconds on the same data. Extracting data via the css function and arrow predicates also seems very slow compared to Libxml2.

like image 40
Alexander Staubo Avatar answered Sep 22 '22 21:09

Alexander Staubo