Hey guys, I have the following code:
void xmlBaseTest::myBlankFile()
{
QFile data
("booklist.xml");
doc->appendChild(root);
if (data.
open(QFile::WriteOnly |
QFile::Truncate)) { doc->save(out,4);
}
}
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);
}
}
To copy to clipboard, switch view to plain text mode
It creates the file:
<!DOCTYPE serverlist>
<booklist/>
<!DOCTYPE serverlist>
<booklist/>
To copy to clipboard, switch view to plain text mode
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
Bookmarks