Hello,

I'm trying to read all the values of a particular tag (in this case 'name') with in the xml file.
below is the actual xml file:

Qt Code:
  1. <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
  2. <response>
  3. <status>ok</status>
  4. <project_list>
  5. <project>
  6. <id>1911</id>
  7. <url>http://www.snipitron.com/arun/Qt_code</url>
  8. <name>Qt code</name>
  9. </project>
  10. <project>
  11. <id>1902</id>
  12. <url>http://www.snipitron.com/arun/Mac_app</url>
  13. <name>Mac app</name>
  14. </project>
  15. </project_list>
  16. </response>
To copy to clipboard, switch view to plain text mode 

And i'm having the Qt code to read the name value as below:

Qt Code:
  1. if (docElement.tagName() == "response"){
  2. stat = docElement.firstChildElement("status").text();
  3. statMsg = docElement.firstChildElement("message").text();
  4. if (stat == "ok" ){
  5. projNameNode = docElement.elementsByTagName("name");
  6. for (uint j = 0; j < projNameNode.count(); j++)
  7. {
  8. nodeMsg = projNameNode.item(j).toElement().attribute("name");
  9. QMessageBox::critical(this, "Arun", nodeMsg, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
  10.  
  11. }
  12.  
  13. }
  14. } else
  15. QMessageBox::critical(this, "Arun", "Status: " + stat + " Message: " + statMsg, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
  16. }
To copy to clipboard, switch view to plain text mode 

I'm missing something here and hence i'm getting NULL as value for nodeMsg.

any help is greatly appreciated.

thanks,
Ar