[Haskell] HaXml ANYContent
mai99dgf at studserv.uni-leipzig.de
Wed Aug 10 20:49:49 EDT 2005
I have some problems with the ANYContent type in HaXml.
Currently (1.13) ANYContent is defined as
data ANYContent = ANYContent
which means I cannot store anything in there.
I need two things:
1) Parse a file where some elements have ANY content, but be able to use the
2) Create a data structure and fill the ANYContent field and be able to write
that to an XML file.
I suggest the following sollution:
> newtype Unparsed = Unparsed String
> data ANYContent = forall a . XmlContent a => Either UnParsed (ANYContent a)
If an XML file is parsed we don't know the type yet. Therefore we put
everything in Unparsed field. Later on one can use a Parser on that
explicitly. It would also make the roundtrip XML->Haskell ->XML more stable.
---- Georg Martius, Tel: (+49 34297) 89434 ----
------- http://www.flexman.homeip.net ---------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20050811/26ac0f91/attachment-0001.bin
More information about the Haskell