HaXml is a collection of utilities for using Haskell and XML together. It includes a parser for XML, a separate error-correcting parser for HTML, and pretty-printers for XML and HTML. For processing tasks, the following components are included:
XmlLib is a combinator library for generic XML document processing, including transformation, editing, and generation. Haskell2Xml is a replacement class for Haskell's Show/Read classes: it allows you to read and write ordinary Haskell data as XML documents. We include a version of Noel Winstanley's DrIFT tool which automatically derives this class for you. DtdToHaskell is a tool for translating any valid XML DTD into equivalent Haskell types. In conjunction with the Xml2Haskell class framework, this allows you to generate, edit, and transform documents as normal typed values in programs, and to read and write them as human-readable XML documents. Finally, Xtract is a grep-like tool for XML documents, loosely based on the XQL query language.
A paper describing just XmlLib and DtdToHaskell/Xml2Haskell is here:
Some additional info about using the various facilities is here:
Development of these XML libraries was funded by Canon Research Europe Ltd.. The library is Open Source, i.e., the bits we wrote are copyright to us, but freely licensed for your use, modification, and re-distribution, provided you don't restrict anyone else's use of it.
We are interested in hearing your feedback on these XML facilities - suggestions for improvements, comments, criticisms. Please mail
Related work: Christian Lindig has written an XML parser in O'Caml: here. Andreas Neumann of the University of Trier has written a validating XML parser in Standard ML: here. Erik Meijer and Mark Shields have a design for a functional programming language that treats XML documents as basic data types: XMLambda. Benjamin Pierce and Haruo Hosoya have a different but similar design in XDuce, which is also implemented.
Known problems: