[solved]QXmlStreamWriter "setDevice(...)" not working
-
I have a problem with the setDevice function of QXmlStreamWriter.
If I do (like it is posted in the QT doc):
@
QByteArray ba;
QBuffer buffer( &ba );
QXmlStreamWriter xml_writer;
xml_writer.setDevice( &buffer );xml_writer.writeStartDocument();
xml_writer.writeDTD("<!DOCTYPE xbel>");
xml_writer.writeStartElement("Element");
xml_writer.writeAttribute("version", "1.0");
xml_writer.writeEndDocument();
QString xml_file( ba );
@I get an empty xml_file string (also the bytearray ba is empty).
If I do:
@
QByteArray ba;
//QBuffer buffer( &ba );
QXmlStreamWriter xml_writer( &ba );
//xml_writer.setDevice( &buffer );
....
@I get the xml message in the bytearray and string.
What do I do wrong?
[edit: mark up code, Tobias Hunger]