# Attributes in Hash.from\_xml

**URL:** <https://www.ruby-forum.com/t/attributes-in-hash-from-xml/118717>\
**Category:** Rails\
**Created:** [October 30, 2007, 12:16pm UTC](https://www.ruby-forum.com/t/attributes-in-hash-from-xml/118717 "2007-10-30T12:16:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [October 30, 2007, 12:16pm UTC](https://www.ruby-forum.com/t/attributes-in-hash-from-xml/118717/1 "2007-10-30T12:16:18Z")

</div>

When i use Hash.from\_xml() to convert xml into a hash, it seems like  
attributes (that don’t relate to the data type of the contents of the  
element) are discarded - is there any way to keep them, does anyone  
know?

Obviously one answer is to avoid xml that stores data in attributes but  
that’s not always possible. Alternatively i could write my own from\_xml  
i guess, but a quick solution is preferred 🙂
