我正在尝试反序列化一个如下所示的XML文件:
<ArrayOf__ptd_student_charges
xmlns="http://schemas.datacontract.org/2004/07/something.something"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<__ptd_student_charges>
...
</__ptd_student_charges>
</ArrayOf__ptd_student_charges>
xmlns=..
部分在反序列化时给我带来了问题,因此在解析它之前我想将根更改为:
<ArrayOf__ptd_student_charges>
<__ptd_student_charges>
...
</__ptd_student_charges>
</ArrayOf__ptd_student_charges>
有没有办法做到这一点?我正在将我的XML从web api加载到XDocument中:
HttpWebRequest request = WebRequest.Create(stringUrl) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
XDocument xdoc = XDocument.Load(response.GetResponseStream());