Which XML libraries do you recommend?


I want to parse ucdxml (the XML version of Unicode Character Database). I find three XML parsing libraries

  • pxp
  • xml-light
  • xmlm

in opam. Which libraries do you recommend? I need only parsing it to some useful OCaml data structure, no need to search, validate etc. One problem, however, is that I do not know the specification of this XML file so I want to experiment the format of XML while developing a parser. For example, I want to print the value of the output of the parser. The doc is voluminous and difficult to understand, so I do not want to understand it completely before starting development.


The only one I would not recommend is xml-light unless you control the format you are parsing yourself (unless it has been updated it’s not standard compliant and will choke on valid xml). Note however that a parser for the ucdxml already exists here.


Thank you. I will take a look.


For completeness, there is also Markup.ml. It is focused on HTML5, but it also includes an XML parser with the same interface.

I would recommend xmlm for most use cases.