I am trying to deserialize an XML file that looks like this:
<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>
The xmlns=..
part is giving me problems when deserializing, so before parsing it I would like to change the root to:
<ArrayOf__ptd_student_charges>
<__ptd_student_charges>
...
</__ptd_student_charges>
</ArrayOf__ptd_student_charges>
Is there any way to do this? I am loading my XML from a web api into an XDocument:
HttpWebRequest request = WebRequest.Create(stringUrl) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
XDocument xdoc = XDocument.Load(response.GetResponseStream());