W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2002

Get xml source of post result

From: Xiaobo Bian <bxb@sunjapan.co.jp>
Date: Tue, 20 Aug 2002 12:06:37 +0900
To: www-lib@w3.org
Message-Id: <20020820114243.E2A2.BXB@sunjapan.co.jp>

Hello, everyone:

I am now using www-lib to post some form data to a cgi on the server
side, then get the result from the cgi that returns xml content.
I just want the xml source without parsing it.
But always nothig is returned instead of the xml source.

My program is as the following:

/* start of main */

  HTChunk * result = NULL;
  HTRequest* request = NULL;
  HTAnchor* anchor = NULL;
  HTAssocList * list = ...; /* form data */
  char* szURL; /* cgi url */
  char* szResult;

  HTProfile_newNoCacheClient("Testing", "1.0");


  HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);

  request = HTRequest_new();
  HTRequest_setOutputFormat(request, WWW_SOURCE);
  anchor = HTAnchor_findAddress(szURL);
  result = HTPostFormAnchorToChunk(list, anchor, request);


  szResult = HTChunk_data(result);
  printf("Result:\n%s\n", szResult); /* here, szResult always seems to
be empty string */

/* end of main */

PRIVATE int terminate_handler (HTRequest * request, HTResponse * response,
                               void * param, int status)
  return 0;

In fact, the requested cgi is a simple program written in Perl.
(Those dealing with parameters are omitted.)

print "Content-type: text/xml\n\n";
print '<?xml version="1.0" encoding="iso-8859-1"?>'."\n";
print '<ROOT>'."\n";
print '<DATA>Hello World</DATA>'."\n";
print '</ROOT>'."\n";

How can I solve this problem?
Any advice is appreciated.


Xiaobo Bian <bxb@sunjapan.co.jp>
Received on Monday, 19 August 2002 23:08:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:55 UTC