Deserialize xml file having namespaces
-
I would like to deserialize the below xml file. I used the below code. It returned exception:"There is an error in XML document (0, 0)."
XmlReader txtReader = XmlReader.Create(reader.BaseStream);
XmlSerializer deSerializer = new XmlSerializer(typeof(ResponseType));
ResponseType resp = (ResponseType)deSerializer.Deserialize(txtReader);Note:reader.BaseStream contains the below xml xml file: ------------
112200eed1b00e42a061
entry in xsd file : -------------------
Class file ----------
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://xyz.com/datacq/xx/service")]
[System.Xml.Serialization.XmlRootAttribute("addMemberResponse", Namespace = "http://xyz.com/datacq/xx/service", IsNullable = false)]
public partial class ResponseType
{
private string info;
public string Info
{
get
{
return this.info;
}
set
{
this.info = value;
}
}
} -
I would like to deserialize the below xml file. I used the below code. It returned exception:"There is an error in XML document (0, 0)."
XmlReader txtReader = XmlReader.Create(reader.BaseStream);
XmlSerializer deSerializer = new XmlSerializer(typeof(ResponseType));
ResponseType resp = (ResponseType)deSerializer.Deserialize(txtReader);Note:reader.BaseStream contains the below xml xml file: ------------
112200eed1b00e42a061
entry in xsd file : -------------------
Class file ----------
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://xyz.com/datacq/xx/service")]
[System.Xml.Serialization.XmlRootAttribute("addMemberResponse", Namespace = "http://xyz.com/datacq/xx/service", IsNullable = false)]
public partial class ResponseType
{
private string info;
public string Info
{
get
{
return this.info;
}
set
{
this.info = value;
}
}
}