records in text files or configuration

Fredrik Thulin <>
Thu Aug 5 23:40:38 CEST 2004

On Thursday 05 August 2004 23.23, Richard Carlsson wrote:
> Fredrik Thulin wrote:
> > I guess I'll have to invent myself some kind of plain text format
> > that is reasonably easy to modify and still easily parseable. Too
> > bad, I'll have to deal with quoting and stuff which would otherwise
> > have been handled for me.
> You won't have to do any text parsing if you use Erlang terms as your
> representation, e.g.:
> [{contact, [{name, "Fredrik Thulin"},
>              {email, ""}]
>   },
>   ...].
> You can still read this using consult(), and it's easy to write a
> function that translates between the internal representation and
> such an explicit keyword/value representation.

Good idea, I didn't think of that (as obvious at it is ;) ). Thanks!

> Or for interoperability with other things as well, use XMerL.
> It allows you to (among many other things) take a list as the above
> and have it automatically output as
> <contact><name>"Fredrik Thulin"</name>
>           <email>""</email>
> </contact>
> ...
> and reversely you can easily read the XML file and get it in
> the same simple list representation again.

Yes, I had thought about using XML for this. I'm not sure if we would 
want to introduce a dependency for something that has to be installed 
separately in our project (Yxa SIP-server/stack) at this point though. 

I'm not even sure how it is done with Erlang... I suppose you make it an 
option in your 'configure' script and make that option add a -pa or -pz 
to your erl command line?


More information about the erlang-questions mailing list