[Haskell-cafe] Stuck on HXT basics
Michael Snoyman
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
> hxt-8.5.4:Text.XML.HXT.DOM.TypeDefs.XNode'
> 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.
>
> Regards,
> Peteris
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
You could try xml-conduit[1] instead. I use it extensively at work.
There's an appendix in the Yesod book[2] covering basic usage.
Michael
[1] http://hackage.haskell.org/package/xml-conduit
[2] http://www.yesodweb.com/book/xml-enumerator
More information about the Haskell-Cafe
mailing list