View Full Version : How to read encoding type in XML file
danbr
24th April 2006, 12:50
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
jpn
24th April 2006, 20:54
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 (http://doc.trolltech.com/4.1/qdomdocument.html)
QDomNode::isProcessingInstruction() (http://doc.trolltech.com/4.1/qdomnode.html#isProcessingInstruction) / QDomNode::toProcessingInstruction() (http://doc.trolltech.com/4.1/qdomnode.html#toProcessingInstruction)
QDomProcessingInstruction::data() (http://doc.trolltech.com/4.1/qdomprocessinginstruction.html#data) / QDomNode::nodeValue() (http://doc.trolltech.com/4.1/qdomnode.html#nodeValue)
Chaid
30th April 2006, 08:17
You can simply use QRegExp
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.