I used xsd.exe on a remote xsd file to generate some C# class definitions. One type is defined as
<xs:element name="amount">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
When I try to deserialize an xml file I get the error:
There is an error in XML document (30, 12). ---> System.FormatException: Input string was not in a correct format.
This only seems to happen when there's a comma used as a grouping separator (i.e 87,000). If I go through and delete the commas wherever there's an error deserialization works fine.
Is there some modification I can make o the xsd to allow for comma grouping? Or better yet a way to allow for it in my code? Trying to parse a decimal in my code with commas works fine, it's just not liking it in the xml file.
"87,000" does not match the xs:decimal
type.
There is no XSD type that permits commas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With