I'm not in mood to get into details but I think all this is supposed to be part of a function
Quote Originally Posted by cshiva_in View Post

QFile file("simple.xml");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug("Failed to open file for reading");
return -1;
}

QDomDocument document;
if(!document.setContent(&file))
{
qDebug("Failed to parse the file into a DOM tree");
file.close();
return -1;
}

file.close();

QDomElement documentElement = document.documentElement();
QDomNode node = document.firstChild();
while(!node.isNull())
{
if(node.isElement())
{
QDomElement element = node.toElement();
cout<<"Element"<<element.tagName();
cout<<"Element attribute name"<<element.attribute("name", "not set")
}


if (node.isText())
{
QDomText text = node.toText();
qDebug << text.data();
}

node=node.nextSibling();
}