lizh06 / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Unable to move a node from one doc to another using LinkEndChild() #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The RemoveChild() method deletes the underlying m_tiXmlPointer so is
unusable. So currently we need to make a clone which is too expensive. I
guess we need a UnlinkChild method like this:

Document* from_doc = ...;
Document* to_doc = ...;
Element* elt = from_doc.FirstChildElement()->FirstChildElement();
from_doc.FirstChildElement()->UnlinkChild(elt);  // Does not exist!
to_doc.FirstChildElement()->LinkEndChild(host);

Greets,
Andrej

Original issue reported on code.google.com by andrejva...@gmail.com on 11 Jul 2008 at 2:18

GoogleCodeExporter commented 9 years ago
There is a typo, "host" should be changed to "elt" of cource:
to_doc.FirstChildElement()->LinkEndChild(elt); 

Original comment by andrejva...@gmail.com on 11 Jul 2008 at 2:20