View Full Version : How to search a string in xml file with Qt Dom classes
doganay44
5th October 2006, 19:47
How to search a string in xml file with Qt Dom classes
I want to use xml file like sql database file.how to i can search a string with qtxml dom classes in xml file.
jpn
5th October 2006, 20:13
You may start with reading docs:
QDomDocument
QDomElement
pay special attention to "Detailed Description" sections. There are example pieces of code..
wysota
5th October 2006, 20:16
If you need DOM functionality, then you need to recurse over children of each element looking for a node you need, for example:
QDomElement findElement(QDomElement parent, const QString &textToFind){
for(QDomElement elem = parent.firstChildElement();
!elem.isNull();
elem = elem.nextSiblingElement()){
if(elem.text()==textToFind) return elem;
QDomElement e = findElement(elem, textToFind);
if(!e.isNull()) return e;
}
return QDomElement();
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.