CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    143

    problem in reading values from an xml

    HI,
    Im building an sample console application..i have attached the source along with the xml file could any one helpme about how to solve this error

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2003
    Location
    The Netherlands
    Posts
    586

    Re: problem in reading values from an xml

    Please specify the exact error you encounter en give us the specific code piece the error occurs in.
    Time is fun when you're having flies

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: problem in reading values from an xml

    Quote Originally Posted by resumurof
    HI,
    Im building an sample console application..i have attached the source along with the xml file could any one helpme about how to solve this error

    Thanks in advance
    The first thing you need to do is resolve the build errors - you have at least one starting with #include "iostream.h". You don't want to include this header because you already have the correct <iostream> header included. Next, check out the line:

    Code:
    bool ret = xmlDoc->load("C://Documents and Settings/admin/Desktop/Feb 19/bslides.Xml");


    You'll get a runtime error on this line because paths in windows need backslashes ('\' instead of '/'). Also strings in C treat a backslash as an escape character so you need to double up on this (from '\' to '\\') to end up with:

    Code:
    bool ret = xmlDoc->load("C:\\Documents and Settings\\admin\\Desktop\\Feb 19\\bslides.Xml");


    Try to make these changes and then post back and I'll tell you the other problems (there are two more).

    TIP: Use w h i t e s p a c e. Indenting and putting whitespace in your code really makes it easier to read.

    Consider the statement:
    Code:
    for (inti=0;i<numitems;i++)


    It's way more easier to read, with a bit of whitespace
    Code:
    for (int i = 0; i < numitems; i++)


    Whitespace is free, so there's no penalty for using it.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured