I have XML where the values are saved in scientific notation and I need to preform some comparisons on that value . But the scientific notation numbers are not working as expected.
Below is the code I have:
XmlDocument doc = new XmlDocument();
doc.LoadXml("<MainLevel><SubLevel Name=\"test\" Amount=\"0.0E0\"></SubLevel></MainLevel>");
XmlNodeList? xmlLevelsList1 = doc.SelectNodes("MainLevel/SubLevel[@Amount<=275.00]");// this does not return anything because 0.0E0 is in scientific notation
doc.LoadXml("<MainLevel><SubLevel Name=\"test\" Amount=\"0.00\"></SubLevel></MainLevel>");
XmlNodeList? xmlLevelsList2 = doc.SelectNodes("MainLevel/SubLevel[@Amount<=275.00]"); this does not return anything because 0.00 is a good format
I want xmlLevelsList1
to return 1 node instead of 0. It is returning 0 because
"0.0E0" is not a valid number.