You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to parse a XML feed with sweet_xml. Due to the nature of the web ;-) there may be feeds that are invalid. In this case I had a feed with a missing element, and thus the XPath expression could not be resolved;
However, this clause matches for an integer cast in this case:
Is this a thing you will want to fix? All other XPath expressions don't lead to a crash, so it seems like a bug to me. On the other hand, the input is invalid; what's the right thing to do here?
To fix this one could add another function clause for empty strings in casts to float or integer; but then it would fail if the input string is not a number.
That's why I didn't create a pull request, I'm really not sure what your thoughts are about this.
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to parse a XML feed with sweet_xml. Due to the nature of the web ;-) there may be feeds that are invalid. In this case I had a feed with a missing element, and thus the XPath expression could not be resolved;
However, this clause matches for an integer cast in this case:
defp to_cast(value, :integer, _is_opt?), do: String.to_integer(to_string(value))
This leads to an argument error because
String.to_integer
gets called with an empty string:Is this a thing you will want to fix? All other XPath expressions don't lead to a crash, so it seems like a bug to me. On the other hand, the input is invalid; what's the right thing to do here?
To fix this one could add another function clause for empty strings in casts to float or integer; but then it would fail if the input string is not a number.
That's why I didn't create a pull request, I'm really not sure what your thoughts are about this.
The text was updated successfully, but these errors were encountered: