ivanotero76
17th January 2017, 13:06
Hi everyone!
I am trying to establish the value of a node like this.
QDomElement name_loc = document.createElement("Name");
document.createTextNode("Hola Mundo");
name_loc.setNodeValue("AA_upatetext");
location_init.appendChild(name_loc);
But it doesn't work.
Node is empty.
I see this link
http://www.qtcentre.org/threads/14392-how-to-modify-the-text-of-node-in-xml-docment
But I don't see clear enough.
Could you help me with this?
Added after 26 minutes:
Sorry, I already found the error.
I need to create QDomText and after appendChild to Node like:
QDomElement name_loc = document.createElement("Name");
QDomText name_loc_text = document.createTextNode(QString(def_name));
name_loc.appendChild(name_loc_text);
location_init.appendChild(name_loc);
I am trying to establish the value of a node like this.
QDomElement name_loc = document.createElement("Name");
document.createTextNode("Hola Mundo");
name_loc.setNodeValue("AA_upatetext");
location_init.appendChild(name_loc);
But it doesn't work.
Node is empty.
I see this link
http://www.qtcentre.org/threads/14392-how-to-modify-the-text-of-node-in-xml-docment
But I don't see clear enough.
Could you help me with this?
Added after 26 minutes:
Sorry, I already found the error.
I need to create QDomText and after appendChild to Node like:
QDomElement name_loc = document.createElement("Name");
QDomText name_loc_text = document.createTextNode(QString(def_name));
name_loc.appendChild(name_loc_text);
location_init.appendChild(name_loc);