Click to See Complete Forum and Search --> : how do I convert from xml to C++ structure


avi123
December 15th, 2003, 06:02 AM
Hello,

I was wondering How do I convert XML to C++ structure and the other way arround

thanks
avi

omri
December 30th, 2003, 03:13 AM
Don't know if I understand the question correctly...

Suggest you write a class that represents the XML data you are expecting. For example, the next XML
<Person>
<Name>avi</Name>
<Age>26</Age>
</Person>
Will be represented by:
class person
{
Public:
int readObject(const string & i_xmlStr);
int writeObject(string o_xmlStr);
private:
string name;
int age;
};
The function readObject and writeObject will parse and generate XML to and from the object's data members.

Cheers