C# code to read xml files
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: C# code to read xml files

  1. #1
    Join Date
    Mar 2014

    C# code to read xml files

    Hi fellow members,

    I'm a C3 newbie and I'm having trouble fixing the issue I'm having with my code.

    This is my code to read this part of the xml file :
    if (reader.Name == "Amount")
    Salary = reader.GetAttribute(1);
    compTotSalary = calcTotals(compTotSalary, Salary);
    Salary= calcAmt(Salary, 11);

    and this is the xml file it's reading



    <Amount Value="450.50" Code="C"/>

    <Amount Value="26889.92" Code="DD"/>


    it is working but it's reading the last salary ( code = DD) instead of the first one.

    Please help!


  2. #2
    Join Date
    Oct 2004
    Rocket City

    Re: C# code to read xml files

    What happens when you try this?
    Salary = reader.GetAttribute(0);

  3. #3
    Join Date
    Mar 2014

    Re: C# code to read xml files

    I get " FormatException was unhandled" error.

  4. #4
    Join Date
    Jul 2001
    Sunny South Africa

    Re: C# code to read xml files

    Set a breakpoint at this line :

    if (reader.Name == "Amount")
    And Step through the code. Have a look in the Output / debug/ watch windows for the values of the read values.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Azure Activities Information Page

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


HTML5 Development Center