# Which XML libraries do you recommend?

**URL:** <https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535>\
**Category:** Learning\
**Created:** [February 6, 2018, 11:00am UTC](https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535 "2018-02-06T11:00:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoriyuki](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yoriyuki/32/17_2.png) [@yoriyuki](https://discuss.ocaml.org/u/yoriyuki)\
**Post date:** [February 6, 2018, 11:00am UTC](https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535/1 "2018-02-06T11:00:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dbuenzli](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dbuenzli/32/18_2.png) [@dbuenzli](https://discuss.ocaml.org/u/dbuenzli)\
**Post date:** [February 6, 2018, 12:30pm UTC](https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535/2 "2018-02-06T12:30:17Z")

</div>

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](http://erratique.ch/software/uucd).

---

<div class="post-metadata">

**Author:** ![yoriyuki](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yoriyuki/32/17_2.png) [@yoriyuki](https://discuss.ocaml.org/u/yoriyuki)\
**Post date:** [February 6, 2018, 12:53pm UTC](https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535/3 "2018-02-06T12:53:46Z")

</div>

Thank you. I will take a look.

---

<div class="post-metadata">

**Author:** ![antron](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/antron/32/62_2.png) [@antron](https://discuss.ocaml.org/u/antron)\
**Post date:** [February 7, 2018, 7:17pm UTC](https://discuss.ocaml.org/t/which-xml-libraries-do-you-recommend/1535/4 "2018-02-07T19:17:25Z")

</div>

For completeness, there is also [Markup.ml](https://github.com/aantron/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.
