I'm have the same problem here, i have tried using QBuffer,QByteArray and Qstring in different combinations with no succsess 
below is the different ways that i have tried:
QSting xml; //with some xml structure
reader.setDevice(&buffer);
//or like this
buffer.setData(xml.toUtf8());
//then
//or this way
reader.addData(xml.toUtf8());
//what the heck! this then Grrr
QXmlStreamReader reader(xml);
QSting xml; //with some xml structure
QByteArray bArray(xml);
QBuffer buffer;
QBuffer buffer(&bArray)
reader.setDevice(&buffer);
//or like this
buffer.setData(xml.toUtf8());
//then
buffer.open(QIODevice::ReadOnly)
//or this way
reader.addData(xml.toUtf8());
//what the heck! this then Grrr
QXmlStreamReader reader(xml);
To copy to clipboard, switch view to plain text mode
after using "setDevice" or just "addData" etc i do the following:
int ret = reader.readNext();
while(!reader.atEnd())
{
if(reader.isStartElement())
{
if(reader.name() == "Application")
ReadApplicationElement();
else
reader.
raiseError(QObject::tr("Error"));
}
else
reader.readNext();
}
int ret = reader.readNext();
while(!reader.atEnd())
{
if(reader.isStartElement())
{
if(reader.name() == "Application")
ReadApplicationElement();
else
reader.raiseError(QObject::tr("Error"));
}
else
reader.readNext();
}
To copy to clipboard, switch view to plain text mode
What am i missing?? it's not the XML because i have tried with QFile and it works that way...
/Robert
Bookmarks