[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Using element's text content as keys from xmlsimple

Srijayanth Sridhar

6/13/2008 1:36:00 PM

Hello,

I have:

<a>
<b weight='220'>Dave</b>
<b weight='140'>John</b>
</a>

I am using xmlsimple to parse something in that format and I want b
organized with the content as keys and weight as values. Is there any
easy way to do this? I've been trying hard with all the options that
xmlsimple provides like { KeyAttr => { 'a' => 'b', 'b' => 'content' }
}...but none of what I've really tried works.

This problem is a small part of a larger problem. The larger problem
is to parse the entire xml into a hash. xmlsimple does it, but with
this problem in place.

Can anyone suggest alternatives/ideas?

Thank you,

J