采用http协议发一个字符串,收到一个xml字符串,要解析,如何实现?
sxbug 2017-06-30 01:58:00 发送的问题,采用idHttp,返回值 :=IdHTTP1.URL.URLEncode (发送字符);其中发送字符为 soap_method=GetPatInfo&Input=<Request><TradeCode>.....包含汉字不知道有问题不?
接收的字符:idHttp1.Get(返回值, stream); Memo2.Lines.Add(UTF8Decode(stream.DataString));这里可以看到返回的部分汉字成了乱码。有办法处理吗?
返回的字符串,一般是<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<GetPatInfoResponse xmlns="http://tempuri.org">
<GetPatInfoResult>
<![CDATA[
<Response><ResultCode>0</ResultCode><ResultContent></ResultContent><PatientID>00067</PatientID><PatientName>张三</PatientName><Sex>女</Sex><SexCode>2</SexCode><DOB>1987-04-15</DOB><TelephoneNo></TelephoneNo><Mobile>1501870003</Mobile>.。。。。。。这样的返回串,如何能快速处理,形成 姓名 张三 性别 女 等,数据库也存储的信息。如何处理会比较方便?
谢谢!请高人指点