Pembar
15th May 2009, 11:13
Hey guys, I have the following code:
void xmlBaseTest::myBlankFile()
{
QFile data("booklist.xml");
QDomElement root = doc->createElement("booklist");
doc->appendChild(root);
if (data.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&data);
doc->save(out,4);
}
}
It creates the file:
<!DOCTYPE serverlist>
<booklist/>
The line <booklist/> is causing problems, when trying to read it later using .setContent. I was wondering if there was any way to get it to print out <booklist></booklist> instead?
Thanks much
void xmlBaseTest::myBlankFile()
{
QFile data("booklist.xml");
QDomElement root = doc->createElement("booklist");
doc->appendChild(root);
if (data.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&data);
doc->save(out,4);
}
}
It creates the file:
<!DOCTYPE serverlist>
<booklist/>
The line <booklist/> is causing problems, when trying to read it later using .setContent. I was wondering if there was any way to get it to print out <booklist></booklist> instead?
Thanks much