[Haskell] HaXml and XML Schema

s_mazanek at gmx.de s_mazanek at gmx.de
Wed Mar 10 08:56:28 EST 2004


I have started thinking about an extension of
HaXml to better support XML Schema, i.e., to
generate appropriate types (like DtdToHaskell)
automatically (cf. Castor for Java).
However, it is not obvious to me how to model
mixed content (character data appears alongside
subelements, i.e., it is not confined to the
deepest subelement).

Example (readers familiar with the problem may
skip this):
<salutation>Dear Mr.<name>Robert Smith</name>.</salutation>

This structure is represented by the XML Schema

<xsd:element name="salutation">
<xsd:complexType mixed="true">
<xsd:element name="name" type="xsd:string"/>

How would you represent this in Haskell?
A first idea may be to store the enclosing strings:

data Salutation = Salutation String Name String

This approach is not scaling well. E.g., there may be multiple 
names in the text...

Do you have other ideas? 

Thank you and Happy Haskelling,

More information about the Haskell mailing list