Regarding QDomDocument
-
Hi
I was using QDomDocument to create the XML file.
By default it will add below line at the start of XML file which I dont want is there any way to remove this?<!DOCTYPE xml ()>
-
Why on earth would you want to remove this already minimal xml header ?
-
@
QDomDocument doc("QDNTest");
QDomProcessingInstruction xmlVers = doc.createProcessingInstruction("xml", "version="1.0" ");
doc.appendChild(xmlVers);
QDomElement root = doc.createElement("QDNTest");
doc.appendChild(root);
qDebug() << doc.toString();
@This creates output
@
<?xml version="1.0" ?>
<!DOCTYPE QDNTest>
<QDNTest/>
@To strip the DOCTYPE from the XML, construct the document without argument:
@
QDomDocument doc;
QDomProcessingInstruction xmlVers = doc.createProcessingInstruction("xml", "version="1.0" ");
doc.appendChild(xmlVers);
QDomElement root = doc.createElement("QDNTest");
doc.appendChild(root);
qDebug() << doc.toString();
@This creates output
@
<?xml version="1.0" ?>
<QDNTest/>
@