View Full Version : XML Serialization of Qt Objects

29th June 2009, 14:40
How do i serialize Qt objects in XML format? I tried using Boost library but it requires me to convert each of my data type to standard C++ datatype. In QDataStream i was able to serialize into binary format. Please let me know how to serialize a whole Qt Object into XML file.

29th June 2009, 20:25
You're going to have to write it yourself, but it should follow the QDataStream class. And if you do, you could use it interchangeably.

There is a problem you will need to tackle though XML is a structured, nested format. QDataStream is only bytes. Therefore when choosing your XML schema, you will be very limited. While not impossible, you'd probably be left with a rather rudimentary set of elements and attributes. You could always map to/from a higher level, but that would be more work.