How to read encoding type in XML file
I’m new to QT so this is probably an easy thing to do, but I’ve not found a solution.
I want to parse/read an XML document using DOM, and I would like to test the values of:
<?xml version="1.0" encoding="ISO-8859-1" ?>
How can I find out which version of XML & encoding type is used?
Thanks
Dan
Re: How to read encoding type in XML file
Qt doesn't seem to provide this functionality out of the box.
You'll have to check processing instruction node's content manually.
Check QDomDocument's child nodes for a "processing instruction" node and parse it's data content by yourself...
Reference:
QDomDocument
QDomNode::isProcessingInstruction() / QDomNode::toProcessingInstruction()
QDomProcessingInstruction::data() / QDomNode::nodeValue()
Re: How to read encoding type in XML file
You can simply use QRegExp