I am using tinyxml.
How do I duplicate or create a copy of an existing XMLDocument?
http://www.grinninglizard.com/tinyxmldocs/classTiXmlDocument.html#a4e8c1498a76dcde7191c683e1220882
I went through this link that says using Clone to replicate a node. But this is protected and I do not want to go for deriving a class out of this and the like.
I also do not want to save the existing XMLDocument to a file and then making another XMLDocument object read the file to have a copy of it.
I am also not able to perform a deep copy using memcpy because I am unaware of the size of the entire XML.
I also do not want to having two objects being used one after the other like:
XMLDocumentObj1 = add_some_data
XMLDocumentObj2 = add_the_same_data, and so on
The primary reason I want a second copy is that, the first might be modified by different sections of the code, while the same copy is being 'read' at multiple places. I need to ensure that there occur no errors when XMLDocument is read, because there are chances that this might have been modified in the background by a running thread, and I get no program crashes.