I am not that good with xml, but my basic xml file looks somthing like this.

Qt Code:
  1. <MAIN_HEADER>
  2.  
  3. <HEADER>
  4. <TITLE>my_title</TITLE>
  5. <AUTOR>DNL</AUTOR>
  6. <NAME>John</NAME>
  7. <AGE>abc</AGE>
  8. <SEX>male</SEX>
  9. <PLACE>abc</PLACE>
  10. <INI_FILE>abc</INI_FILE>
  11.  
  12. </HEADER>
To copy to clipboard, switch view to plain text mode 

what I want to do is, I need to find 2-3 tags, say for example NAME & SEX and store the attribute(John,Male) in another variable.

until now, I have been able to make it read the xml file.

Qt Code:
  1. void MainWindow::XMLParser()
  2. {
  3. QString path=MainWindow::getWorkingDirectory()+"\\0_Config\\";
  4. QString string;
  5. string = path + ui->ConfigFiles_combo->currentText(); \\THIS IS WHERE´IT DETERMINES WHICH XML FILE IT IS
  6. qDebug()<<string;
  7. QDomDocument document;
  8. //load the file
  9. QFile file(string);
  10. if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
  11. {
  12. qDebug()<<"Failed to open the file";
  13.  
  14. }
  15.  
  16. else
  17. {
  18. if(!document.setContent(false))
  19. {
  20. qDebug()<<"Failed to load document";
  21.  
  22. }
  23. file.close();
  24. }
  25. QDomElement root = document.firstChildElement();
  26. qDebug()<<"finished";
  27.  
  28. }
To copy to clipboard, switch view to plain text mode 

how do I make it search for the exact tag and store it inside another variable?