PDA

View Full Version : QDomNode replaceChild is not work



lucasbemo
6th December 2010, 12:49
Hi,

I'm trying to use the code below, but I have not had success. Could anyone help me?
NewCode this object always null. : /


QDomNode *oldNode = &this->documento.childNodes().at(2).childNodes().at(4).ch ildNodes().at(0).childNodes().at(indiceLinhaAtual) ;
QDomNode newNode = this->documento.childNodes().at(2).childNodes().at(4).ch ildNodes().at(0).replaceChild( nodeAux, *oldNode);

franz
6th December 2010, 17:03
Eh, what is the exact purpose of that piece of code?

Added after 4 minutes:

Never mind. QDomNode is explicitly shared. You don't need the pointer semantics:


QDomNode oldNode = this->documento.childNodes().at(2).childNodes().at(4).ch ildNodes().at(0).childNodes().at(indiceLinhaAtual );
QDomNode newNode = this->documento.childNodes().at(2).childNodes().at(4).ch ildNodes().at(0).replaceChild( nodeAux, oldNode);

Try that first. If that doesn't do what you want it to do, then explain here.

And read through the QDomNode docs carefully (including the class description).