QDOMLite - Light weight DOM/XML
-
QDOMLite.h. Quick and Dirty Document Object Model. Fast and low-resource one-file XML.
in your .pro:
CONFIG += c++11 DEFINES += QT_USE_QSTRINGBUILDER
Parse example:
QTreeWidgetItem* i = new QTreeWidgetItem({"Document"}); ui->treeWidget->addTopLevelItem(i); QDomLiteDocument d("yourfile.xml"); parseElement(d.documentElement,i); void parseElement(QDomLiteElement* e, QTreeWidgetItem* i) { for (QDomLiteElement* c : e->childElements) parseElement(c,new QTreeWidgetItem(i,{c->tag})); }
File:
-
-
File has now been updated (still same link).
QRegExp has been replaced with QRegularExpression. The fromString function now has some clever look-ahead and passes smaller substrings when recursing.
Performance has been improved considerably, up to 100 times for really large files. Have fun!