Ciao a tutti,
ho un problema nella deserializzazione di un file XML che deve seguire questo formato.
codice:
<SystemConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns=".....">
....altri tag
<Timers>
<Timer Name="MSD1" Time="11:45:00" ></Timer>
<Timer Name="MSD2" Time="15:45:00" ></Timer>
<Timer Name="MSD3" Time="23:45:00" ></Timer>
</Timers>
</SystemConfiguration>
Nella classe SysConfig ( la cui istanza deserializza il file xml) definisco Timers come un array di SystemConfigurationTimers
codice:
/// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "......")] [System.Xml.Serialization.XmlRootAttribute("Timers", Namespace = "......")] public partial class SystemConfigurationTimers
{ private SystemConfigurationTimer[] timer;
/// <remarks/>
public SystemConfigurationTimer[] Timer
{ get { return this.timer; }
set{ this.timer = value; }
}
}
A sua volta SystemConfigurationTimer
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = ".....")]
public partial class SystemConfigurationTimer
{
private string name;
private string time;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Name
{
get
{ return this.name;}
set
{ this.name = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Time
{
get
{return this.time;}
set
{this.time = value}
}
}
La deserializzazione mi torna timers= null
Dove sbaglio?
Grazie
Mike "The Ram"