[Qt-interest] QTXml file access problem

Hasnat Raza hasnatzaidi at gmail.com
Wed Sep 16 18:08:14 CEST 2009


hi, I am trying to access xml file and modify it..like
 <options>
       <screen>SESSION_#_SCREEN</screen>
       <workspace>SESSION_#_WORKSPACE</workspace>
       <autostart>SESSION_#_AUTOSTART</autostart>
       <iconmode>SESSION_#_ICON</iconmode>
 </options>
 these xml contents are accessible ??and how
 Here is code........
*QDomDocument doc("session");*

* QFile file("session.xml");*

* if (!file.open(QIODevice::ReadOnly))*

* return;*

* if (!doc.setContent(&file)) {*

* file.close();*

* return;*

* }*

* file.close();*

* // print out the element names of all elements that are direct children*

* // of the outermost element.*

* QDomElement docElem = doc.documentElement();*

* QDomNode n = docElem.firstChild();*

* while(!n.isNull()) {*

* QDomElement e = n.toElement(); // try to convert the node to an element.*

* if(!e.isNull()) {*

* cout << qPrintable(e.tagName()) << endl; // the node really is an element.
*

* }*

* n = n.nextSibling();*

* }*

*
*

*
*

*Thanks*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090916/bfd82f7a/attachment.html 


More information about the Qt-interest-old mailing list