Thank you for your answer MogalManic.
Yes, exactly as I described in my question, the problem is an empty element for a decimal type. And the problem would not occure, if the element is of type "string".
My hope was to avoid the uggly workarounds: e.g. to define all fields of the XML as "string" and then iterate through the whole XML and checking each value.
To reformulate my question:
Is it possible with .NET to read a XML file without getting a FormatException under following conditions:
a) There is a schema file for reading the respective XML, which defines some fields as numeric types (e.g. decimal, int)
b) The XML file may contain empty elements for numeric fields
Main Topics
Browse All Topics





by: MogalManicPosted on 2009-09-18 at 06:24:04ID: 25365632
I think the problem is an empty element (e.g. <SORT_ORDER/> or <SORT_ORDER></SORT_ORDER>) is interpreted as "" which is not of type decimal. To test this, try changing the type to string and see what the value is.