# Using element's text content as keys from xmlsimple

**URL:** <https://www.ruby-forum.com/t/using-elements-text-content-as-keys-from-xmlsimple/140393>\
**Category:** Ruby\
**Created:** [June 13, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/using-elements-text-content-as-keys-from-xmlsimple/140393 "2008-06-13T15:37:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srijayanth\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@Srijayanth\_S](https://www.ruby-forum.com/u/Srijayanth_S)\
**Post date:** [June 13, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/using-elements-text-content-as-keys-from-xmlsimple/140393/1 "2008-06-13T15:37:36Z")

</div>

Hello,

I have:

 **Dave**  **John** 

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
