XML Serialization / Deserialization in C ++

I am using C ++ from Mingw which is the Windows version of GNC C ++.

What I want to do: Serialize C ++ object to XML file and deserialize object from XML file on the fly. I am checking out TinyXML. This is very helpful and (please correct me if I don't understand) it basically adds all the nodes during processing and finally puts them in a file in one chunk using the TixmlDocument :: saveToFile (filename) function.

I am working on realtime processing and how can I write to a file on the fly and add the following result to the file?

Thank.

+2


source to share


4 answers


I noticed that each TiXmlBase class has a print method and also supports streaming of strings and streams.

You can sequentially view new parts of the document and display those parts as they are added, perhaps?



Try .....

Tony

+2


source


Here's the best example of serializing C ++ objects:



http://www.codeproject.com/KB/XML/XMLFoundation.aspx

+3


source


BOOST has a very nice serialization / deserialization lib BOOST.Serialization .
If you pass your objects to boost xml archive , it will pass them in xml format. If the xml is large or slow, you need to modify the archive in text or binary archive to change the streaming format.

+2


source


I have used gSOAP for this purpose. It's probably too powerful for just serializing XML, but knowing that it can do a lot more, I don't need to consider other solutions for more advanced projects, as it also supports WSDL, SOAP, XML-RPC, and JSON. Also suitable for embedded and small devices as XML is just a transitional wire format and is not stored in DOM or any memory.

0


source







All Articles