[Haskell-cafe] Stuck on HXT basics

Pēteris Paikens peterisp at gmail.com
Mon Jan 30 14:06:42 CET 2012

I'm quite stuck on getting HXT working to do my xml parsing, can you
help me to get started?
Even in http://www.haskell.org/haskellwiki/HXT#Getting_started:_Hello_world_examples
the basic filter example that's given there in section 6:

import Text.XML.HXT.Core
import Text.XML.HXT.DOM.XmlTreeFilter
selectAllText	:: ArrowXml a => a XmlTree XmlTree
selectAllText  = deep isXText

fails with the following error message. What could I be doing wrong?

    Couldn't match expected type `Data.Tree.NTree.TypeDefs.NTree XNode'
                with actual type `hxt-8.5.4:Data.Tree.NTree.TypeDefs.NTree
    Expected type: a (Data.Tree.NTree.TypeDefs.NTree XNode) XmlTree
      Actual type: Text.XML.HXT.DOM.XmlTreeTypes.XmlFilter
    In the first argument of `deep', namely `isXText'
    In the expression: deep isXText

On the other hand, perhaps you can suggest something other than HXT -
my needs would be taking "heavy" XML's (a lot of little-neccessary
structure, but correctly validated), extracting text tokens from it
and outputting them with some light tagsoup annotation.


More information about the Haskell-Cafe mailing list