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 8296817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:09:54+00:00 2026-06-08T15:09:54+00:00

I have been having some trouble using RapidXML to parse a string. I receive

  • 0

I have been having some trouble using RapidXML to parse a string. I receive an error from within Eclipse claiming the parse function does not exist.

make all 
Building file: ../search.cpp
Invoking: Cross G++ Compiler
g++ -DDEBUG -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"search.d" -MT"search.d" -o "search.o" "../search.cpp"
../search.cpp: In function ‘void search(CURL*, CURLcode, std::string, std::string)’:
../search.cpp:29:27: error: no matching function for call to ‘rapidxml::xml_document<>::parse(const char*)’
../search.cpp:29:27: note: candidate is:
../rapidxml-1.13/rapidxml.hpp:1381:14: note: template<int Flags> void rapidxml::xml_document::parse(Ch*) [with int Flags = Flags, Ch = char]
make: *** [search.o] Error 1

The following code raises an error:

rapidxml::xml_document<> doc;    // This has no errors
doc.parse<0>(data.c_str());      // This line raises the error (data is a string)

For reference here is the online documentation:
http://rapidxml.sourceforge.net/manual.html#namespacerapidxml_1parsing

RapidXML comes as four header files:

  1. rapidxml_iterators.hpp
  2. rapidxml_print.hpp <–contains errors, but build is successful with them
  3. rapidxml_utils.hpp <–contains errors, but build is successful with them
  4. rapidxml.hpp <–linked by program, contains parse function

How do I resolve the error in my code, and do I first need so resolve compiler errors in the headers somehow?

  • 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-06-08T15:10:01+00:00Added an answer on June 8, 2026 at 3:10 pm

    The problem is that the char* returned from calling c_str() on a std::string is actually a const char* which is no good for the parse function (parsing actually changes the string that it parses in rapidXML). This means we need to copy the string before we parse it

      xml_document<> doc;
      string str;                             // String you want to parse
      char* cstr = new char[str.size() + 1];  // Create char buffer to store string copy
      strcpy (cstr, str.c_str());             // Copy string into char buffer
    
      doc.parse<0>(cstr);                     // Pass the non-const char* to parse()
    
      // Do stuff with parsing
    
      delete [] cstr;                         // free buffer memory when all is finished
    

    I have not attempted to compile the above so there maybe errors, the point is that c_str() returns a const char* and parse() must take a non-const char*. Hope this helps. As for your headers, I usually get away with only using

     rapidxml.hpp
     rapidxml_print.hpp
    

    included in my source files. You have no linker issues because RapidXML is header only implementation (which makes it nice in my opinion).

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

Sidebar

Related Questions

I have been having some trouble lately with using custom classes as types. As
I have been having some real trouble with this for a while. I am
I have been having trouble pulling up a custom UIPickerView from the textfield's inputview
I have been having some trouble finding a good way to output just the
I've been having some trouble using an IN in a where clause using MySQLi
I'm having some trouble extending Classes in PHP. Have been Googling for a while.
I'm having some trouble opening an existing blackberry eclipse project I have to work
I have been having some trouble figuring out how exactly I get a process's
I am having some trouble with this. We basically have been asked to create
I have been having some trouble to select the rows of my table which

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.