Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6601899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:48:45+00:00 2026-05-25T18:48:45+00:00

I have a project that reads some data from xml file Convert.ToDouble metod works

  • 0

I have a project that reads some data from xml file
Convert.ToDouble metod works wrong.
it converts 0.05 as 5.
is there any idea to solve this problem?

this is my ReadDataFromXml method:

public static List<double> XmldenTabanDegerleriniOku(string ID)
{

    string ayarDir = System.Environment.CurrentDirectory + "\\Ayarlar";
    string Dosya = ayarDir + "\\YuzeyBoyutlari.xml";
    XmlDocument doc = new XmlDocument();
    doc.Load(Dosya);

    XmlNodeList holList = doc.GetElementsByTagName("HOL");
    List<double> tabanDegerleri = new List<double>();
    foreach (XmlNode node in holList)
    {
        XmlElement holElement = (XmlElement)node;

        if (node.Attributes["ID"].Value == ID) { 
            double uzunluk =Convert.ToDouble(holElement.GetElementsByTagName("uzunluk")[0].InnerText.Replace('.',','));
            double genislik =Convert.ToDouble(holElement.GetElementsByTagName("genislik")[0].InnerText.Replace('.',','));
            double cizgilerArasiMesafe = Convert.ToDouble(holElement.GetElementsByTagName("cizgilerArasiMesafe")[0].InnerText.Replace('.', ','));
            tabanDegerleri.Add(uzunluk);
            tabanDegerleri.Add(genislik);
            tabanDegerleri.Add(cizgilerArasiMesafe);
            break;
        }


    }
    return tabanDegerleri;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:48:46+00:00Added an answer on May 25, 2026 at 6:48 pm

    Don’t use Convert.ToDouble then: use XmlConvert.ToDouble. I believe that effectively uses the invariant culture (as XML documents conveying data shouldn’t be culture-specific in that sense).

    EDIT: I hadn’t noticed that you were manually replacing ‘.’ with ‘,’ – so when you say that “it is converting 0.05 as 5” you really mean “it is converting 0,05 as 5”. You should use XmlConvert and stop messing with the data yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Forms project in Visual Studio that reads configuration files from
Got a project that collects data as XML files from a particular system (these
I have some socket connection code that makes use of boost::asio which reads from
I have a class that outputs a simple report file. It reads some record
I have a xml file that changed when i update some values, and i'm
I've got some code to convert a large (many gigabytes) XML file into another
I want to store some data from structures like this: class Project { ChildA
My project requires a file where I will store key/value pair data that should
We have some XSDs in our project that define types that use attributes, as
I have a small issue. I am trying to pull some data from my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.