最近总gsoap编写了个访问公共webservice的客户端(http://fy.webxml.com.cn/webservices/EnglishChinese.asmx?op=Translator)英文翻译
其返回类型是这样(一个XML)
<TranslatorResult>
<xsd:schema>schema</xsd:schema>xml</TranslatorResult>
</TranslatorResponse>
用gsoap的工具生成源代码后,发现返回值为
class SOAP_CMAC _ns1__TranslatorResponse_TranslatorResult
{
public:
char *xsd__schema; /* required element of type xsd:schema */
char *__any;
public:
......
};
这两个字符串实际就是返回的xml的字符串形式,请问我现在如何解析出这个字符串(xml)中的各个标签的值呢?
看了gsoap自带的dom工具,不知道如何使用,
他的例子是这样的
soap_dom_element dom;
dom.soap = soap_new1(SOAP_DOM_TREE | SOAP_C_UTFSTRING);
cin >> dom; // parse XML
if (dom.soap->error)
... // parse error
cout << dom; // display XML
......
文档说 >> 操作符作为解析操作符,可左边(cin)需要一个std::istream啊,我目前有 char *也无法转换啊
也没有找到合适的例子,请高手指教啊!这个问题纠结了好几天了~
