How to generate <?xml version="1.0" encoding="UTF-8" standalone="0" ?> in xml using Dom or XMLStreamWriter????
Can i have a sample of it.. thanks...
Cos i don noe how to code the part...
How to generate <?xml version="1.0" encoding="UTF-8" standalone="0" ?> in xml using Dom or XMLStreamWriter????
Can i have a sample of it.. thanks...
Cos i don noe how to code the part...
You can add it before setting content,,,
like if u have xml data in xmlData,
you can write - xmlData.prepend("<?xml version="1.0" encoding="UTF-8" standalone="0" ?>");
and then write to QDomDocument.
thanks... for xmlData need any lib???
xmlData is the file or xml??
is it QXmlStreamWriter xmlData;
xmlData.prepend("<?xml .. .. .. ?>");
xmlData is ur QString.
refere QDomDocument::setContent()
Im almost getting correct. can i ask how to insert the QString into the first line of the xml file??
Is it using the "insertBefore(newValue,referValue);" ??
See QDomDocument::createProcessingInstruction():
Qt Code:
QDomDocument doc; QDomProcessingInstruction pi = doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"0\""); doc.appendChild(pi); qDebug() << doc.toString();To copy to clipboard, switch view to plain text mode
J-P Nurmi
Bookmarks