Q. about XML support

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Thu, 20 Feb 2003 16:48:00 +0000


Graham Klyne had some questions about XML parsing in Haskell.  Here is
the current state of play with HaXml.

> 1. Works with HUGS and GHC (I'm currently developing with HUGS, but 
> anticipate using GHC for "production" code).

HaXml certainly works with ghc (and ghci).  It probably still works
with Hugs too - the only current unresolved issue there is how to
package it up nicely for Hugs (cpp #ifdefs, installation location, etc).

> 2. Namespaces, though I'm prepared to roll-my-own on top of an existing XML 
> parser.

About a year and half ago, someone did some work on adding namespaces
to HaXml, but it never got folded back into the main distribution.  It may
be possible to port that solution into the current tree (I can give you
a contact email).

> 3. Well-formedness checking would be nice;  i.e return a useful error 
> indication if tags are mismatched, that sort of thing.

HaXml does well-formedness checking, although the quality of the error
messages may not always be the best.  (An ambiguous parse sometimes
causes the error message to point to the wrong location.)

> 4. Validation is not required for my application.

HaXml also does validation, and the error messages here are actually
very helpful.

> I also thought briefly about adding namespace support, and contemplated 
> replacing your
>     type Name = String    -- from memory, maybe not exactly right?
> with something like
>     data Name = QName String String
> where the two strings would be namespace URI and local name 
> respectively.  I haven't yet figured what the cascading effects of such a 
> change might be.

I imagine the same approach would would equally well in HaXml as in HXML.

> BTW, do you have a test suite for your parser?

Not as such.  However, the SMIL 2.0 and DocBook DTDs go through
smoothly, and they are fairly large and complicated beasts.

Regards,
    Malcolm