I’ve been working on the Erlang Markup Language for most of the coding time I’ve had this weekend and I’m making some great progress. I started off trying to figure out how I was going to traverse the XML tree I had created using xmerl, after reading the documentation I was more confused about what I wanted to do then I was when I started.

I took to reading through the xmerl code and I found the xmerl_lib modules, which has a mapxml/2, foldxml/2 and mapfoldxml/3 functions that after reading them thoroughly them they turned out to be the greater part of the work I was planning on doing today :-) This bring me back to the biggest problem I have with Erlang; the documentation. In my opinion, the three greatest functions in the xmerl library were the ones I found today and they are not mentioned in the documentation anywhere … But i digress …

After figuring out that I was going to need to use mapfoldxml/3 so be able to modify the structure of the document and accumulate changes in the state at the same time I was off to the races.

The first challenge was to create a ermlset command to set variables. I wanted this command to set the variables and to let the variables change at any point later on the page. (I’ve been enjoying the irony of writing a scripting language that lets you change variables values in a language that does not) Then after the variable is set I needed to remove the command from the output of the apple. I ended up replace the command with a generic ermlcommand that I remove all of the references to ermlcommand after processing.

Once I had my ermlset command working I moved along to the ermlloop command. I’m planning on having several loops, including a index or counter loop, a list loop and a conditional loop. I started with the index loop, just displaying some text a number of times. I got that working with a few glitches with out too much trouble and then I implemented some recursion into it, which managed to solve some of my glitches. (I’ve never figured out why, but for some reason my code runs better after I implement recursion. It’s happened about 4 times now, anyway …)

After I built int he recursion I was able to perform ermlset command within the loop and I have nested ermlloop statements … not bad for a days work.

Next, is working on the if/then/else statements, hopefully that will work just as easily.

ERML,Erlang,ErlWeb,Markup Language

Technorati Tags: , , ,

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists