[Haskell-cafe] curious hxt error

brad clawsie clawsie at fastmail.fm
Tue Jul 31 01:12:07 EDT 2007


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.

consider this sample script:

module Main where
import Text.XML.HXT.Parser
main = do
  xml <- getContents
  print $ head $ xread xml

and this file content (test.xml):

<?xml version="1.0"?>
<foo><bar>BAR1</bar><bar>BAR2</bar></foo>

running:

$ runhaskell hxt.hs < test.xml 
NTree (XError 2 "\"string: \"<?xml
version=\\\"1.0\\\"?>\\n<foo><bar>BAR1</ba...\"\" (line 1, column
6):\nunexpected xml\nexpecting legal XML name character\n") []

which clearly indicates a choke on the xml declaration

but if i remove the xml declaration, i see no errors and i am able to
get a valid data structure printing out

any ideas?

thanks 
brad



More information about the Haskell-Cafe mailing list