0

I'm having trouble reading an xml file from a server location. When the file is opened locally on the computer, it appears to work fine. However, when the file is opened from a location on a server, it does not work. Do you know what the problem may be? Am I using the forward slash incorrectly?

The following works:

rapidxml::file<> xmlFile("myfile.xml");
rapidxml::xml_document<> doc;

The following does not work:

rapidxml::file<> xmlFile("http://localhost/myfile.xml");
rapidxml::xml_document<> doc;
code
  • 5,294
  • 16
  • 62
  • 113

2 Answers2

1

Why don’t you use downloader library like ‘curl’ and download to your local and use it like normal file system operation.

dg_no_9
  • 1,005
  • 1
  • 10
  • 25
  • Hm, I would prefer to be able to read the xml directly from the server. I used the same url in the browser and I am able to view the xml... I'm not sure if this is a limitation in RapidXML or if I'm using the wrong type of forward/backslashes in my string.. – code Jan 16 '14 at 18:00
1

RapidXML is just an XML parser, not an HTTP client. You'll need to use an HTTP client library to retrieve a file from a URL.

Roddy
  • 66,617
  • 42
  • 165
  • 277
  • Ahh I see.. I've never done something like this before (accessing a file via HTTP to retrieve a file). Do you have any suggestions on what library to use? Is there something in the standard library that I can use? http://www.cplusplus.com/reference/ Any help would be appreciated. – code Jan 17 '14 at 23:51
  • @user1456962. It depends on your OS, dev tools, etc. But look at this question: http://stackoverflow.com/questions/1124129/high-level-http-client-library-for-native-c-c-in-win32 – Roddy Jan 20 '14 at 23:06