HaXml


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:

The document is 12 pages of double-column A4.

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:


Current version
HaXml version 1.00, gold release, 2000.11.16 complete source code and documents. .tar.gz .zip
(Finally added support for the external subset of DTDs.)

Older versions
HaXml version 0.9, beta release, 2000.02.22 complete source code and documents. .tar.gz .zip
(Reworked the Haskell2Xml and Xml2Haskell modules.)
HaXml version 0.8b, beta release, 2000.01.26 complete source code and documents. .tar.gz .zip
(Some minor bugfixes to DrIFT, ensuring H'98 compatibility.)
HaXml version 0.8a, beta release, 2000.01.12 complete source code and documents. .tar.gz .zip
(No code changes - just some restructuring of the build tree.)
HaXml version 0.8, beta release, 2000.01.05 .tar.gz .zip
(Bugfix: some PERefs didn't work.)
HaXml version 0.7, beta release, 1999.10.12 .tar.gz
(Fixed imports for GHC.)
HaXml version 0.6, beta release, 1999.08.31 .tar.gz
(Fixed preprocessor symbols to use the new standard __HASKELL98__.)
HaXml version 0.5, beta release, 1999.08.27 .tar.gz
(Added GE entity reference-handling to parser, tweaked the pretty-printer, ensured Haskell'98 compliance.)
HaXml version 0.4, alpha release, 1999.04.26 .tar.gz
(Added separate HTML parser, some other bugfixes.)
HaXml version 0.3, alpha release, 1999.04.20 .tar.gz
(Bugfix release.)
HaXml version 0.2, alpha release, 1999.04.15 .tar.gz
(Added Haskell2Xml and Xml2Haskell. Improved XML parser and printer.)
XmlLib version 0.1, alpha release, 1999.01.12: .tar.gz
(Initial release.)