Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:36:38+00:00 2026-05-28T16:36:38+00:00

I am receiving string as a XML document with this function: void HttpWindow::replyFinished(QNetworkReply *reply)

  • 0

I am receiving string as a XML document with this function:

void HttpWindow::replyFinished(QNetworkReply *reply)
{
     QString data = reply->readAll().trimmed();
     bool value=document->setContent(&data);
}

and here is my slot and signal:

connect(reply, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));

When I put above code I get error that there is not pre-defined function that receive one string as I have sended…Can somone try to correct this so I can see how to put this Qstring value into xml document. So I can read XML

Thank you

EDIT:
these are the functions that I have to choose, I have tried all but it seems I am not sending right paremeters:

 // Qt extensions
    bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(const QByteArray& text, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(const QString& text, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(QIODevice* dev, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );
    bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0 );

EDIT 2:
I can’t compile it, I can give you this code:

httpwindow.cpp: In member function 'void HttpWindow::replyFinished(QNetworkReply*)':
httpwindow.cpp:140: error: no matching function for call to 'QDomDocument::setContent(QString*)'
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:343: note: candidates are: bool QDomDocument::setContent(const QByteArray&, bool, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:344: note:                 bool QDomDocument::setContent(const QString&, bool, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:345: note:                 bool QDomDocument::setContent(QIODevice*, bool, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:346: note:                 bool QDomDocument::setContent(QXmlInputSource*, bool, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:347: note:                 bool QDomDocument::setContent(const QByteArray&, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:348: note:                 bool QDomDocument::setContent(const QString&, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:349: note:                 bool QDomDocument::setContent(QIODevice*, QString*, int*, int*)
..\..\..\..\Desktop\Qt\4.7.4\mingw\include/QtXml/qdom.h:350: note:                 bool QDomDocument::setContent(QXmlInputSource*, QXmlReader*, QString*, int*, int*)

Or tell me what to do to get that Qdebug output. You mean like Qdebug<<data ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:36:40+00:00Added an answer on May 28, 2026 at 4:36 pm

    There is indeed no overload of QDomDocument::setContent() which takes a QString pointer, passing by value would fix the error.

    However there is another serious issue in your code which is that you are trying to convert from a QByteArray (the result of readAll()) to a QString. This is not only unnecessary but dangerous, since the conversion is done assuming the content is ascii. You can just call document->setContent(reply).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a small project that is receiving XML data in string
I'm receiving XML sent via POST. Naturally I need to parse this XML to
I'm trying to send an XML document over the wire but receiving the following
I'm receiving data from web-services in XML and I'm using that data via objects,
I'm receiving XML data via an AJAX call. One of the tags has a
I am receiving XML data from a service. The test data I am receiving
Hi Fellow StackOverflowers, I am receiving a string in one of my .NET function.
I am receiving long string of checked html checkbox values (Request.Form[mylist] return Value1,Value2,Value3....) on
I have a very basic query string which passes a ID to a receiving
I am currently receiving this error: Validation of viewstate MAC failed. If this application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.