PDA

View Full Version : What about error: C2039 'createElement': no es un miembro de 'QDomComment'



ivanotero76
13th January 2017, 09:30
Hi everyone!

I keep trying to implement some piece of code to write in a xml file some tags.

I see this video tutorial:

https://www.youtube.com/watch?v=NXGE5XUrRSI

I'll show you below




#include <QtXml>

int main(int argc, char *argv[])
{
Q_UNUSED(argc);
Q_UNUSED(argv);

// Write XML
QDomComment document;

// Make the root element
QDomElement root = document.createElement("Campus");

// Add it to the document
document.appendChild(root);

// Write to file
QFile file("C:/XML_OUT/gbxml.xml");
if(!file.open(QIODevice::WriteOnly | QIODevice::Text ))
{
qDebug() << "Failed to open file for writting";
return -1;
}
else
{
QTextStream stream(&file);
// stream << document.toString();
file.close();
qDebug() << "Finished";
}

return a.exec();
}




error: C2039: 'createElement': no es un miembro de 'QDomComment'

error: C2039: 'toString': no es un miembro de 'QDomComment'

ChrisW67
13th January 2017, 10:11
Line 9 should read:


QDomDocument document;

See the video at 1:50.

ivanotero76
13th January 2017, 11:25
Thank you. It solved