For example if I have a xml like this -

Qt Code:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <tree path="//" message="SUCCESS">
  3. <item restype="0" resname="1myd" size="-" ver="-"
  4. lmd="2014/03/12 02:29:09" thumb="N" attrib_star="0"
  5. attrib_desc="0" share="-" capture_date="0"
  6. save_time="2014/03/12 02:29:09" chk="NA"/>
  7. <item restype="0" resname="Test333" size="-" ver="-"
  8. lmd="2014/03/11 00:53:42" thumb="N" attrib_star="0"
  9. attrib_desc="0" share="-" capture_date="0"
  10. save_time="2014/03/11 00:53:42" chk="NA"/>
  11. </tree>
To copy to clipboard, switch view to plain text mode 


Now I need the whole node as string like this-
Qt Code:
  1. Output:
  2. <item restype="0" resname="Test333" size="-" ver="-" lmd="2014/03/11 00:53:42" thumb="N" attrib_star="0" attrib_desc="0" share="-" capture_date="0" save_time="2014/03/11 00:53:42" chk="NA"/>
To copy to clipboard, switch view to plain text mode 

What I tried was not giving me this whole thing as text.
Qt Code:
  1. void Util::parseXml(void)
  2. {
  3. QDomDocument domDoc("myDoc");
  4. QFile file("/home/rahul/Desktop/file.xml");
  5. if(!file.open(QIODevice::ReadOnly))
  6. return;
  7. if (!domDoc.setContent(&file))
  8. {
  9. file.close();
  10. return;
  11. }
  12. file.close();
  13.  
  14. QDomNode node = domDoc.elementsByTagName("item").at(0);
  15. QDomElement elem = node.toElement();
  16. qDebug() << elem.text();
  17. }
To copy to clipboard, switch view to plain text mode 

Kindly help me with this. Thank you.