Using element's text content as keys from xmlsimple

S

Srijayanth Sridhar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top