XML to haskell data

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 30 Jan 2002 18:50:59 +0000

> Has anyone done any XML parsing into haskell data structures? I'd
> like to do some of this and don't like reduplicating effort.

The HaXml package has a tool `DtdToHaskell' that automatically converts
an XML DTD into a set of Haskell datatypes, together with the necessary
instances of an `Xml2Haskell' class, which provides methods to read and
write the Haskell data from/to an XML document.  The Haskell datatypes
you get might not necessarily be as clean as you would write by hand,
but they are at least a faithful encoding of the DTD.

HaXml also includes a general XML parser and ugly-printer.
Joe English's `hxml' package has a more space-efficient parser,
which can interface nicely to the rest of HaXml.

HaXml is integrated as part of the ghc hslibs collection, or can be
downloaded separately from

Hxml is available from