<A xmlns="http://www.aaa.com/bbb/"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<B>
<aa>AUH</aa><bb>5</bb><cc>Abu</cc>
</B>
<B>
<aa>AUH</aa><bb>7</bb><cc>ghi</cc>
</B>
<ServiceResponse><ErrorMessage i:nil="true"/><ExecutionStatus>SUCCESS</ExecutionStatus></ServiceResponse>
</A>
I have a XML Like Above and I have created classes For A, B and ServiceResponse.
And I am trying to parse using the below code:
XmlSerializer ser = new XmlSerializer(typeof(A));
objAirportListResponse = ser.Deserialize(new StringReader(str)) as A;
In above code "str" is the string which contain above XML.
I am getting error like below:
There is an error in XML document (1, 2)(System.InvalidOperationException)
If i remove the xmlns="http://www.aaa.com/bbb/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" From the XML i got the same error at because of i:nil="true". Then i removed xmlns="http://www.aaa.com/bbb/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" and i:nil="true" i tried to parse the XML, This time it parsed in to class successfully.
But removing xmlns="http://www.aaa.com/bbb/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" and i:nil="true" is not a correct way, Please help me how parse above Example.
Thanks in Advance.