CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: XML and C++

  1. #1
    Join Date
    Jun 2005
    Posts
    115

    XML and C++

    Well I actually had 2 questions, I wanted to know if it was better to have all monster information and stuff in a text file or XML and have it pulled. Keep in mind this is for a game obviously.

    The 2nd question is if I should use the textfile or xml where could I find a guide / tutorial on how to use xml and C++ together.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: XML and C++

    I don't understand your problem. If you look for an XML library to use in C++ see xerces-c or MSXML parsers.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: XML and C++

    Quote Originally Posted by Forsakenblade
    Well I actually had 2 questions, I wanted to know if it was better to have all monster information and stuff in a text file or XML and have it pulled. Keep in mind this is for a game obviously.

    The 2nd question is if I should use the textfile or xml where could I find a guide / tutorial on how to use xml and C++ together.
    Better to Keep All the Information in a XMl File.Because Storing and Retriving data in a XML File is fast and easy from a text File. n No of Articles are present on Google just Search For Them.
    Thanx

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: XML and C++

    Quote Originally Posted by humptydumpty
    Better to Keep All the Information in a XMl File.Because Storing and Retriving data in a XML File is fast and easy from a text File. n No of Articles are present on Google just Search For Them.
    Thanx
    I think that depends on what kind of data he wants to save (which he didn't say). It is possible that it would make more sense to store it serialized in a binary format. It all depends on what data.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: XML and C++

    Quote Originally Posted by cilu
    I think that depends on what kind of data he wants to save (which he didn't say). It is possible that it would make more sense to store it serialized in a binary format. It all depends on what data.
    i think Soo .But if you gave a look on the OP Original post he want to Store a Monster information and if there is n no of monster then i think he should move with XML only because n individual node can contain information about n monster .and here XML benefit comes in existence .because storing and retriving is pretty past in comarision to a text File. Still i am Agree With you that we Still want Some more information to answered his query.

    Thanx

  6. #6
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: XML and C++

    Quote Originally Posted by humptydumpty
    i think Soo .But if you gave a look on the OP Original post he want to Store a Monster information and if there is n no of monster then i think he should move with XML only because n individual node can contain information about n monster .and here XML benefit comes in existence .because storing and retriving is pretty past in comarision to a text File. Still i am Agree With you that we Still want Some more information to answered his query.

    Thanx
    IMO, XML parsing & updating is a LOT slower then say ini file. Even if you use a SAX parser instead of DOM. And the other drawback is (again IMO), that most of the times just the document structure (tags attributes etc etc) takes more space then the data itself.

    My 2 cents...

    Hope this helps,
    Regards,
    Usman.

  7. #7
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: XML and C++

    If you are going for speed, I wouldn't take XML or txt. Put it in binary structures with some form of smart indexing. ..

  8. #8
    Join Date
    Jun 2005
    Posts
    115

    Re: XML and C++

    Well i was planning on storing stuff like this in the xml

    [monster 1]
    name = rabbit
    type = animal
    minlevel = 1
    maxlevel = 3
    hp = 30

    then have another file where each monster is located and have it be called something like this
    1,3,4 (where 1 is the monster #, 3 being the x coord, 4 being the y coord) then having it load somehow like that.

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