qbwc / qbxml

QBXML Parser and Validation Tool
MIT License
27 stars 41 forks source link

Float parsing blows up on % symbol #18

Closed jhmoore closed 8 years ago

jhmoore commented 8 years ago

One of our customers' Items query is returning a percentage that has an actual % symbol in the float field. E.g.

<PricePercent>18.0%</PricePercent>

The implementation of FLOATTYPE uses Float(), which is throwing an exception for us when trying to parse 18.0%. Any reason it couldn't be a to_f there instead?

JasonBarnabe commented 8 years ago

Only reason I can see would be in case it returns a completely non-float number, you'd want an error instead of 0.0. But I've never had that case, nor have I heard of anyone who has, so a PR for to_f would be OK with me.

jhmoore commented 8 years ago

Thanks! Opened https://github.com/qbwc/qbxml/pull/19