Hi Uwe Schmidt, thanks a lot. Just one more question, I didn't find any example describing how to get the text information of a XML element in the picklers tutorial. So, if the use case element is described as follwing:
<useCase> <id>UC_01</id> <name>Opening ...</name> <description>This use case describes how...</description> </useCase> How can I set the id, name and desription of a use case? -- use case data type data UseCaseModel = UCM Name [UseCase] data UseCase = UseCase Id Name Description deriving (Show) -- I tried the following picler implementation -- but I think that it is not correct. instance XmlPickler UseCase where xpickle = xpUseCase xpUseCase :: PU UseCase xpUseCase = xpElem "useCase" $ xpWrap ( \ (i, n, d) -> UseCase i n d, \t -> (ucId t, name t, description t)) $ (xpTriple (xpElem "id" xpText) (xpElem "name" xpText) (xpElem "description" xpText)) > 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/ > ----------------------------------- Rodrigo Bonifácio de Almeida Universidade Católica de Brasília - Grupo de Engenharia de Software - JavaComBr (www.ucb.br/java) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe