From: Ben Giddings Date: 2003-10-03T09:14:47+09:00 Subject: Re: xml + ruby = happy programmer paul vudmaska wrote: > I mean something like this... > > #(presuming %x creates an xml literal.) > x = %x{is your friend} > > #access it like this... > print x.m.l #>is your friend > > as opposed to > x = {'m'=>{'l'=>'is your friend'}} > > print x['m']['l']#something like that. > > I'm not a ruby guru and might not even be that good a > programmer but i like the first better. Much. How do you propose to handle an element like: The set of allowable characters in an XML element is larger than the set of allowable characters in a Ruby method name: http://www.w3.org/TR/REC-xml#NT-NameChar As for x = %x{is your friend} There was recently a long discussion on this list about new "percent letter brace" tricks. I think the general feeling was that it was simpler to just create a method that takes a string as an argument and returns an XML element. I don't know if there are any methods that do that, but how would you feel about: x = XMLParser.parse "is your friend" If that's too wordy, you could always say: def xml(arg) XMLParser.parse(arg) end x = xml "is your friend" Ben