Before opening XML document the header was
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
But after using QDomDocument
if (!file.open((QIODevice::ReadOnly)))
{
return;
}
QDomDocument document;
if (!document.setContent(&file))
{
return;
}
file.close();
if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly)) {
return;
}
QTextStream out(&file);
document.save(out, 2);
file.close();
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
I know what xml standart allows to use single quotes. But I need to use double quotes.
You could either use QXmlStreamWriter which prefers double quotes, or you could postprocess the string representation of you document before streaming. For example:
out << document.toString(2).replace('\'', '\"');
Alternatively, you could also submit a feature request on the Qt issue tracker to add some configuration to QDomDocument and see whether the Qt developers think.