Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access some XML data with Haskell (using HaXml)?

Tags:

xml

haskell

haxml

I want to get access to the data of an XML file like

<?xml version="1.0"?>
<MY>
  <Foo id="1" name="test">
    <Argument name="a" />
  </Foo>
  <Foo id="2" name="test2">
    <Argument name="a" />
    <Argument name="b" />
  </Foo>
  <Other id="2" name="someOther"/>
</MY>

I want e.g. to read out each Foo with its Arguments, how can I do this with Haskell? (I would like to use the HaXml module)

I don't know where to start.

like image 579
develhevel Avatar asked May 21 '11 14:05

develhevel


2 Answers

For simple tasks you might want to consider the tagsoup package.

like image 163
augustss Avatar answered Sep 29 '22 12:09

augustss


Yes, documentation is a big cons about haskell. I wonder why haskell people hate documenting their code so much. No need for fat papers, few usage examples is usually more than enough.

Also small example of HaXML usage available here: http://book.realworldhaskell.org/read/extended-example-web-client-programming.html

like image 33
Dfr Avatar answered Sep 29 '22 14:09

Dfr