[Haskell] Re: state of HaXml?

Terrence Brannon metaperl.haskell at gmail.com
Sat Dec 30 20:05:07 EST 2006


Ok, I got it working:

module Main where
import qualified Text.XML.HaXml as X
import qualified Text.XML.HaXml.Parse as XP
import qualified Text.XML.HaXml.Pretty as XPP
import qualified IO
import qualified System


load fn = do
             contents <- readFile fn
             return $ XP.xmlParse fn contents

main = do [xml] <- System.getArgs
          d <- load xml
          IO.putStrLn $ show $ XPP.document $ d

<?xml version="1.0" encoding="UTF-8"?>
<employee>
<!-- A list of employees -->
 <name EmpType="Regular">
  <first>Almanzo</first>
  <last>Wilder</last>
 </name>
 <name EmpType="Contract">
  <first>Laura</first>
  <last>Ingalls</last>
 </name>
</employee>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell/attachments/20061230/befbed7b/attachment-0001.htm


More information about the Haskell mailing list