views:

218

answers:

2

Hi,

I want to implement in my MFC application project this logic, which written in C# looks like:

XmlSerializer ser = new XmlSerializer(typeof(A_CLASS));

StringBuilder sb = new StringBuilder();

XmlWriterSettings sett = new XmlWriterSettings();

sett.Indent = true;

sett.IndentChars = "\t";

using (XmlWriter sw = XmlWriter.Create(sb, sett)) { ser.Serialize(sw, A_CLASS_Instance); }

Can someone tell me how to write it in C++?

A: 

As far as I know, MFC doesn't provide any classes for XML serialization. But there might be libraries out there.

Eduardo León
+1  A: 

MFC will not really help you here, but as usual in C++ today, Boost is your friend :)

The Boost.Serialization library has xml_oarchive and xml_iarchive. For simple examples, have a look here: http://www.fnord.ca/articles/xml.html

However – do check out the answers to this question as well.

Pukku