Hi,

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 
content.
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.

Cheers,
 Georg
        
-- 
---- Georg Martius,  Tel: (+49 34297) 89434 ----
------- http://www.flexman.homeip.net ---------

Attachment: pgpJAjmgegubt.pgp
Description: PGP signature

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to