QXmlConfig config;
config.create();
...
// u can now read/write config
config.saveAs( filename ); // to save as
To load an existing XML use:
QXmlConfigconfig;if(config.load(filename)){INFO_LOG("Xml file opened successfully");}else{ERROR_LOG(QString("Error opening template xml file: %1, filename=%2").arg(config.getLastErrorMsg()).arg(filename));returnfalse;}...//dowhatyouwantandthensaveconfig.save();
Textual issues with XML are automatically handled (ok, maybe except for Base64 encoding which is out of the scope of this class)
// from current parent nodeQStringvalue6=config.getFirst("david[5]");
use config.pushCurrentLocation() and config.popCurrentLocation() to push/pop
current location on the stack. useful when traversing a big configuration file.
You can read/write attributes on the current element.
I guess this class is not 100% complete and tested. Documentation except for this wiki is spartan, yet this is the only (non strict GPL) Xml Config util class available. So, I hope you will find it useful.
Hi,
Usage:
To create a new XML use:
To load an existing XML use:
Textual issues with XML are automatically handled (ok, maybe except for Base64 encoding which is out of the scope of this class)
To read/write XML use:
use config.pushCurrentLocation() and config.popCurrentLocation() to push/pop
current location on the stack. useful when traversing a big configuration file.
You can read/write attributes on the current element.
I guess this class is not 100% complete and tested. Documentation except for this wiki is spartan, yet this is the only (non strict GPL) Xml Config util class available. So, I hope you will find it useful.
GPL alternatives (mine is better! :) )
QXmlSettings @ http://code.google.com/p/qt-dms/
QXmlPutGet @ http://www.workslikeclockwork.com/index.php/components/xml-classes-for-qt/
Last edit: rubi13133 2013-08-04