daniel
1
Hello,
I am trying to figure out how to replace a node in an XmlTree object. Something like:
for ( XmlTree node : myConfig ) {
if ( node->getTag() == "reference" ) {
node = myOtherNode;
}
}
So that the old node is deleted and myOtherNode is injected at exactly the same position.
Any ideas?
Hi,
This thread might help from the old forum.
-Gabor
1 Like
daniel
3
Perfect, thank you very much! I somehow missed that thread.
lithium
4
You’re copying into node
. Try iterating with a reference:
for ( XmlTree& node : myConfig )
{ // ^ This cheeky fellow here.
if ( node->getTag() == "reference" ) {
node = myOtherNode;
}
}
1 Like
daniel
5
haha. Just came back to report my major facepalm. Sorry for the inconvenience 