Using element's text content as keys from xmlsimple

Discussion in 'Ruby' started by Srijayanth Sridhar, Jun 13, 2008.

  1. 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
     
    Srijayanth Sridhar, Jun 13, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HANM
    Replies:
    2
    Views:
    724
    Joseph Kesselman
    Jan 29, 2008
  2. hborda
    Replies:
    1
    Views:
    86
    David Vallner
    Nov 5, 2006
  3. slothbear
    Replies:
    2
    Views:
    121
    slothbear
    Jul 20, 2007
  4. Matt Valblade

    XMLsimple & probem

    Matt Valblade, Oct 11, 2007, in forum: Ruby
    Replies:
    4
    Views:
    99
    Matt Valblade
    Oct 11, 2007
  5. Maui Guide
    Replies:
    1
    Views:
    115
    Robert Klemme
    Apr 17, 2009
Loading...

Share This Page