Reputation: 1171
I have written below simple code to read xml. but setting content itself is failing for me.
I am using Visual studio 2010 and Qt 4.8.5 lib.
QDomDocument document;
QFile file(str);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
cout << "Failed to open file";
}
else
{
if(!document.setContent(&file)) // here my sample code is failing and going inside this
{
cout << "Failed to load document";
}
}
file.close();
Upvotes: 0
Views: 170
Reputation: 27611
If setContent is failing, then it is likely that the XML is not valid. You can check the XML with a validator, such as this one.
Upvotes: 1