From: Rover Rhubarb Date: 2007-05-09T23:19:36+09:00 Subject: Re: using YAML as config James Gray wrote: > I think mine is an unpopular opinion among Rubyists, but I find XML > easier to write, as a human, than YAML. YAML just has too many rules > I have to remember. XML is definitely wordier, but I can keep the > rules in my head as I work. My editor also makes managing those tags > fairly easy. > > If all I'm doing is a simple edit here and there though, YAML is > easier on the eyes, for sure. Amen. I might not have agreed with you had I just read about YAML, but after going through this process I'm a born again xml convert. I also agree YAML is easier on the eyes. If were just ser-deser I was after, I'd probably go with YAML. > >> I know it's not the same because I'm going to have to parse the XML >> and build the objects > > I'm pretty sure there's a library or two that handles that: > > http://raa.ruby-lang.org/cat.rhtml? > category_major=Library;category_minor=XML > Thanks for this tip. Of these, http://clabs.org/clxmlserial.htm looks the most promising. Note, btw, the home page of myxml (http://raa.ruby-lang.org/project/myxml/), where it states: (* use YAML instead, it's 100% better for small apps ;-)) > This is where we start to disagree. > > You asked for simple and even showed examples of what you had in > mind. I wrote code that parses it. Simple pays off at both ends. > > You wanted to drop the computerese; my version did. In fact, mine > doesn't need those dashes. With a one byte change, you could also > make indenting the attributes optional. It gets better and better > for the human who needs to write it and it's still not complex on > your end. > > Finally, I think it's easier to read or write than XML or YAML. > > When your needs are big, of course you want to go with a proven > format. What you showed is simple though and parsed just fine with a > few lines of code. I don't see any shame in that. > > James Edward Gray II Fair point. -- Posted via http://www.ruby-forum.com/.