Re: How to send a xml file to a server?

Ailleen Lien wrote:
> 
> Anybody out there with sample code for sending a xml file to a server?

Depending upon how you want it stored or processed on the server,
one example is to simply use the POST method like the libwww example:

http://www.w3.org/Library/Examples/post.c

and send the XML from an in memory char * (converting to UTF-8 encoding
or
whatever encoding you are using).
The URL on the server could be, for instance, a servlet handling
doPost()
reuqests and it could process this text/xml instance...

some useful additions to the post.c sample code would
be setting up the correct MIME type by adding things like:

HTAnchor_setFormat(src, HTAtom_for("text/xml"));
HTAnchor_setCharset(src, HTAtom_for("UTF-8"));

If your app wanted to build up the char * data in steps you could
consider using an instance of a libwww HTChunk to do this and then
grab the resulting total char * with HTChunk_data(...) when you are
ready to POST

Jeff Adams

Received on Monday, 11 December 2000 15:11:16 UTC