以下是我用于从Web服务中提取xml的代码:
string ServerURl = "xxX"
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ServerURl);
request.ContentType = "application/xml+atom";
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
var datastream = response.GetResponseStream();
XmlReader reader = XmlReader.Create(datastream);
ds.ReadXml(reader);
有两种类型的元素可以返回格式,如:
<m:table>
<d:Identification m:type="Edm.Int32">12346</d:Identification>
<d:EmployeePhone m:type="Edm.Int32">123456</d:EmployeePhone>
<d:EmployeeName>Joe Doe</d:EmployeeName>
我注意到 m:type 的所有行都没有返回,我该如何包含这些?