From: James Edward Gray II Date: 2007-05-08T21:40:40+09:00 Subject: Re: using YAML as config On May 8, 2007, at 5:17 AM, Rover Rhubarb wrote: > YAML should beat XML hands down - this is one case where it doesn�t. 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. > 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 > James: thanks for giving me a solution that does what I asked exactly. > But to be honest here I wanted to use an existing format, not invent > one. (I guess it could be argued that by wanting to customize my > YAML to > get rid of the ---!! I am trying to invent one - but I really want > that > to be an existing feature of YAML) 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