change Hash#to_xml to convert xml with attribute and content properly

This is in response to #9965

It rightly parses something like
```xml
<varValue name="age">25</varValue>
```
to
```ruby 
{"varValue"=>{"name"=>"age", "__content__"=>"25"}}
```