Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How to store XML content into C/C++ structure

How to store XML content into C/C++ structure

Scheduled Pinned Locked Moved XML / XSL
c++xmlhelptutorialquestion
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello everyone, I have this XML document and I need to store the content in a C/C++ structure. So far I can use MSXML to load the document and display it but how can I get it into C/C++ struct. I'm completely new to C/C++, can anyone help me to create a C/C++ struct to hold these data and also how to get the XML into the structure created. Many thanks! John Moss 28 8 Polygon Road London UK Karate Second degree black belt 1992 1994 1995 1996 :confused:

    N P 2 Replies Last reply
    0
    • L Lost User

      Hello everyone, I have this XML document and I need to store the content in a C/C++ structure. So far I can use MSXML to load the document and display it but how can I get it into C/C++ struct. I'm completely new to C/C++, can anyone help me to create a C/C++ struct to hold these data and also how to get the XML into the structure created. Many thanks! John Moss 28 8 Polygon Road London UK Karate Second degree black belt 1992 1994 1995 1996 :confused:

      N Offline
      N Offline
      Nitron
      wrote on last edited by
      #2

      struct PERSONAL
      {
      CString szName;
      int age;
      int house_number;
      CString szStreet;
      CString szTown;
      CString szCountry;
      };

      struct SPORT
      {
      CString szStyle;
      CString szBelt;
      CString szChampion;
      };

      struct CONTACT
      {
      PERSONAL personal;
      SPORT sport;
      };

      void foo()
      {
      std::vector<CONTACT*> vpContacts;

      for(int i=0; i<nContacts; i++)
      {
      vpContacts.push_back(new CONTACT);
      vpContacts[i]->personal.szName = "Sam";
      ...
      }

      do_something(...);

      vpContacts.clear();
      }

      - Nitron


      "Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb

      1 Reply Last reply
      0
      • L Lost User

        Hello everyone, I have this XML document and I need to store the content in a C/C++ structure. So far I can use MSXML to load the document and display it but how can I get it into C/C++ struct. I'm completely new to C/C++, can anyone help me to create a C/C++ struct to hold these data and also how to get the XML into the structure created. Many thanks! John Moss 28 8 Polygon Road London UK Karate Second degree black belt 1992 1994 1995 1996 :confused:

        P Offline
        P Offline
        palbano
        wrote on last edited by
        #3

        >> I can use MSXML to load the document and display >> it but how can I get it into C/C++ struct. well once u have read the file into the MSXML document it is in a C/C++ structure. why would u want to copy the data into another one?

        "No matter where you go, there your are..." - Buckaoo Banzi

        -pete

        P 1 Reply Last reply
        0
        • P palbano

          >> I can use MSXML to load the document and display >> it but how can I get it into C/C++ struct. well once u have read the file into the MSXML document it is in a C/C++ structure. why would u want to copy the data into another one?

          "No matter where you go, there your are..." - Buckaoo Banzi

          -pete

          P Offline
          P Offline
          palbano
          wrote on last edited by
          #4

          sorry i already gave u this answer

          "No matter where you go, there your are..." - Buckaoo Banzi

          -pete

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups