[Haskell-cafe] Processing XML with HXT

Uwe Schmidt uwe at fh-wedel.de
Wed Apr 23 02:27:37 EDT 2008


Hi Rodrigo,

> I´m just starting with HXT. My question is, how can I expose a "use case" from the main function below (the XmlPickler for UseCase has been already defined):
> 
> main :: IO ()
> main = do
>       runX ( xunpickleDocument xpUseCase [ (a_validate,v_0) ],  "uc.xml" )
>       return ()
> 
> For example, if I just want to show the use case contents, how can I call "show" for a retrived use case.

-------------------------------------

1. version

main :: IO ()
main = do
       [x] <- runX ( xunpickleDocument xpUseCase [ (a_validate,v_0) ],  "uc.xml" )
       print x
       return ()

x is processed outside the arrow

-------------------------------------
2. version

main :: IO ()
main = do
       runX ( xunpickleDocument xpUseCase [ (a_validate,v_0) ],  "uc.xml" 
              >>>
              arrIO print
            )
       return ()

x is processed within an arrow by lifting the print function to then arrow level.

------------------------------------

There is a new wiki page about picklers
http://www.haskell.org/haskellwiki/HXT/Conversion_of_Haskell_data_from/to_XML

Cheers,

  Uwe

-- 

Uwe Schmidt
Web: http://www.fh-wedel.de/~si/


More information about the Haskell-Cafe mailing list