[Haskell-cafe] curious hxt error

Albert Y. C. Lai trebla at vex.net
Tue Jul 31 15:48:09 EDT 2007


brad clawsie wrote:
> i am having a problem with hxt, i was wondering if anyone here has
> experience with it. in particular, i find that the xread function
> chokes on xml files with xml declarations, and i am not sure why.
[...]

This is intended. Generally, wherever the HXT manual says "content" 
(e.g., the description of xread says "with the XML content parser"), it 
means the (one and only) top level element, i.e., the <foo>...</foo>.

To parse a complete XML file, look for a parser that says "document", 
which means the whole thing, e.g., parseXmlDocument.

main = do
   xml <- getContents
   print $ head $ parseXmlDocument "test.xml" xml


More information about the Haskell-Cafe mailing list