Hello Everybody.
With this posting I offer yuo 3 new methodes for the class TiXmlNode.
1. TiXmlNode* TiXmlNode::cut(TiXmlNode* cutThis )
This methode cuts a xml-child without eraseing it, thus it is possible to paste it somewhere else.
2. TiXmlNode* TiXmlNode::pasteBeforeChild( TiXmlNode* beforeThis, TiXmlNode* addThis )
This Methode puts an independent xml-element as new xml-sibbling before an other xml-child without copying it.
3. TiXmlNode* TiXmlNode::pasteAfterChild( TiXmlNode* afterThis, TiXmlNode* addThis )
This Methode puts an independent xml-element as new xml-sibbling after an other xml-child without copying it.
In my both projects "Moritz" and "MuLanPa" (here on sourceforge) I'm working sometimes with very deap xml-trees and one of my key-works is to merge 2 or more xml-trees into one. In the current implemntation of the node-class a resorting of the xml-structer is done with a lot of copy-work and this is time-consuming. I know this is a very save way to prevent pointer problems and the user of my methodes has to be very carefull as with every pointer-solution. But once you know how to deal with them you are able to speed up your application.
I use this additions together with the current tinixml 2.6.1 as public methodes into the interface of the node-class.
The easiest way to do so is to inser an inlude-line into the header "tinyxml.h" to include the header "TiXmlNode_ao.h"
directly under the definition of the current existing public-methodes I have placed the directive "#include "TiXmlNode_ao.h"
" directly over the protected-section of the class-definition of "TiXmlNode" (somewhere under line 740 under the definition of the methode " virtual bool Accept( TiXmlVisitor* visitor ) const = 0;" but over the line with "protected:").
But my proposal is to add this 3 methodes in the next official release and I hope the files I added are helpfull as documentation.
Best Regards,
Eckard Klotz.
source-code and somme additional documentation