Ben Schumacher
10/3/2003 12:22:00 AM
paul vudmaska said:
> I mean something like this...
>
> #(presuming %x creates an xml literal.)
> x = %x{<m><l>is your friend</l></m>}
>
> #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.
Sorry to focus on just this aspect of this post... this would never work.
How would I translate this element <element-name/> into this format?
## this
x = %x{<element-name>stuff</element-name>}
print x.element-name
## would evaluate to x.element (minus) name.
Unfortunately, the characters allow in element names don't allow this
"native" support. As a developer who uses XML daily, I find the current
interface extremely useful and powerful... especially with XPath. I don't
want to have to DOM grovel down two different elements, when I can just as
easily do: x['//i-need-this-one']
My 2c.
bs.