Getting There is an error in XML document (2, 2) Error during DeSerialization RRS feed

  • Question

  • I am using a webservice which is serialized a class named ‘voucher’ and it's child’ voucher detail’ and create an xml file

    I called this webservice in my application and also I am trying to desterilize the mentioned classes

    To same entities in this project by using below code:

    var serializer = new XmlSerializer(typeof(T));

     var x = (T)serializer.Deserialize(new StringReader(xml));


    And I get this Error: There is an error in XML document (2, 2).


    Please help me.

    I think there might be for using collection is there any special attribute which I have to put on them on my class???

    Saturday, September 21, 2013 11:00 AM


  • I would check the xml first to make sure there is not some strange character in there.  Also if the xml is created with one app and deserialized in another make sure the class you are deserializing is in an dll that you can reference in both apps to avoid and error with name spaces not matching
    Sunday, September 22, 2013 3:57 PM