Menu

Duplicating TiXmlDocument

pamakela
2007-08-22
2013-05-20
  • pamakela

    pamakela - 2007-08-22

    Hello!

    I have a small programming project which makes use of TinyXML in msvc++ 2003. Everything works fine, but I can't figure out how to duplicate a TiXmlDocument instance. In my prog I have two in-memory documents, let's say pool1 and pool2. There's an iteration going on which reads pool1 for input and inserts resulting data into pool2. Before the next iteration, I need to empty pool1, duplicate the resultant pool2 into it, and then empty the pool2 as well - so that the results are there for the next iteration.

    So how to switch/duplicate TiXmlDocument in a case like this.. ?

    Regards,

    - PM

     
    • Lee Thomason

      Lee Thomason - 2007-08-26

      PM --

      That's moving a lot of memory around. You might look for a simpler approach? But you can certainly copy and clear with the current API:

      TiXmlDocument doc1, doc2;
      ...
      doc1 = doc2;  // copies document 2 to 1
      doc2.Clear(); // clears the children of the document

      good luck,
      lee

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.