XE2 XML Attribute can't convert to double

early

New Member
I have a XML node with attributes like this:\[code\]<pad name="E" x="2.5" y="7" drill="1.3"/>\[/code\]When I assign the \[code\]Attributes["x"]\[/code\] into a double I get the result 25, not 2.5 but without any complaints or errors.To get a correct conversion I first have to assign the attribute to a string, replace the decimal '.' to a decimal ',' and then convert the string to a double. It is clearly that the \[code\]Attribute["x"]\[/code\] can't convert but it doesn't say anything! (bug?!?)Here is the code with faulty conversion:\[code\]double x = XMLNode->Attributes["x"];\[/code\]This gives a faulty x of 25 instead of 2.5 and here is my work around:\[code\]String sd = XMLNode->Attributes["x"];if (sd.Pos(".")) sd[sd.Pos(".")] = ',';double x = sd.ToDouble();\[/code\]This gives the correct value in x (2.5)There MUST be a more simple way to do this!// Thanks
 
Back
Top