XML : How To Track Down Deserialize XML to Object Error in XSD?

This is a sample of my xml file:

  <IFX xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="finalizacaoOrcamentoVO">  <dadosOrcamento>...</dadosOrcamento>  <faturamento>...</faturamento>  </IFX>    

This is my auto-generated by Visual Studio object class:

    /// <remarks/>  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]  [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]  public partial class IFX  {        private IFXDadosOrcamento dadosOrcamentoField;        private IFXFaturamento faturamentoField;    

But I've been getting this error every time I try to deserialize:

Message "Error document XML (1, 57)." string

This is my deserialize method:

                  IFX document;                  XmlSerializer serializer = new XmlSerializer(typeof(object));                  using (var reader = XmlReader.Create(file.InputStream))                  {                      document = (IFX)serializer.Deserialize(reader);                  }    

Any hint on what should be fixed? Thanks in advance!

No comments:

Post a Comment