[Haskell-cafe] Simple question about processing XML with HaXml

Dominic Espinosa dcespin at fastmail.fm
Wed Jun 25 11:37:30 EDT 2008


I'm trying to learn how to use HaXml, but I'm having trouble getting off
the ground. I can see from the documentation how to process XML using
the combinators and processXmlWith, but processXmlWith seems to "hide"
the actual process of reading and parsing the XML. Suppose that
processXmlWith isn't suitable for a program. How then do you load the
XML and apply filters to it?

I guess what I'm asking is, given the following code:

load filename = do
  handle <- IO.openFile filename IO.ReadMode
  contents <- IO.getContents handle
  IO.hclose handle
  return $ xmlParse filename contents

myTest fname = do
  -- read file
  d <- load fname
  --- ?? now what?

I'm sure the answer to this is quite simple, but I'm coming from a
background of OO and SAX, and the HaXml docs are a bit cryptic as yet.

Additionally, if anyone knows of any tutorials pertaining to HaXml,
other than the papers on the HaXml website and the blog entries on
cleaning legacy HTML, I'd appreciate some pointers.


More information about the Haskell-Cafe mailing list