[Haskell-cafe] Stuck on HXT basics
michael at snoyman.com
Mon Jan 30 14:14:17 CET 2012
On Mon, Jan 30, 2012 at 3:06 PM, Pēteris Paikens <peterisp at gmail.com> wrote:
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
You could try xml-conduit instead. I use it extensively at work.
There's an appendix in the Yesod book covering basic usage.
More information about the Haskell-Cafe