Simple io issue

  • I am trying to do something very simple: to generate an XML document to be used as the body of an HTTP request. QXmlStreamWriter provides a set of methods to write desired XML nodes to any QIODevice. QNetworkAccessManager provides methods to send HTTP requests, reading request body data from a QIODevice. Using these tools, I would have a reader and writer. How can I get data from the writer to the reader, keeping in mind that the network transfer is likely to be much slower than the XML generation, causing the possiblity of buffer overflows?

  • How big is this XML payload?

  • Hi, Almost all QIOdevices have a "GetStatus" function. This returns the availability of data ready to read/write. Check it out ;-)

  • The payload is not enormous, but I want to avoid a DOM-based approach, if that's where you're going.

    How does the getStatus() help? I know the status of each instance, I just don't know the best way to move data FROM a WRITER, TO a READER. That's the issue.

  • Serialise your small-ish XML payload using QXmlStreamWriter into a QBuffer/QTemporaryFile and then feed that to QNetworkAccessManager::post().

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.