Project

General

Profile

How to request and parse a xml file?

Added by Markus Wolters over 11 years ago

Hi,

I need to download a xml file from another side on a regular base, parsing its data when download is finished. I think it has to be done with help of a WFileResource, but im lost using it. Can anyone please give an example on how to do it?

Thanks Markus


Replies (3)

RE: How to request and parse a xml file? - Added by Koen Deforche over 11 years ago

Hey Markus,

There is no support in Wt to open a connection to another server (i.e. to act as a HTTP client).

You should consider another library for this.

One possible way is to use Boost.Asio (which is already being used by Wt in the httpd).

See for example src/Wt/Http/Client.C implementation (doGet() function) on how to use this to do

a HTTP request, or start from one of the Boost.Asio examples, which also contain HTTP client implementations.

Regards,

koen

RE: How to request and parse a xml file? - Added by Wim Dumon over 11 years ago

Or you could use e.g. curl, which is already a well-tested http client implementation.

wim.

RE: How to request and parse a xml file? - Added by Markus Wolters over 11 years ago

Curl works fine, thanks a lot...

    (1-3/3)