cloocher / xmlhasher

Fast XML to Ruby Hash converter
MIT License
40 stars 20 forks source link

Parsing xml data types - integer, booleans etc. #3

Closed michaldarda closed 5 years ago

michaldarda commented 9 years ago

Hello,

I have xml fragment that looks like this:

<id type="integer">2</id>

And it parses to

:id=>{:type=>"integer", :value=>"2"}

I think parser should automatically detect data types like this, and parse automatically to:

:id=>2

Same with booleans and other data types (I think it already does this with arrays) fallbacking to value, type pair only if data type is not known. Let me know if you are interested in this kind of improvement.

Cheers

cloocher commented 9 years ago

@michaldarda,

It's a reasonable ask. However, I don't think it should be the default behavior since it's not backward compatible.

If you want to add option flag to turn this behavior on, I am open to merge your patch.

Thanks!

stepozer commented 5 years ago

After many years I think we can close this issue.