所以我有這個類生成與xsd.exe,當我反序列化到我的對象的XML它不讀取所有的屬性。看起來像樹中的最後一個屬性沒有被讀取。XML的一些標籤沒有被反序列化
這是對象的類之一:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(IsNullable=true)]
public partial class relation : myXml {
/// <remarks/>
public object a;
/// <remarks/>
public object b;
/// <remarks/>
public object c;
/// <remarks/>
public object d;
/// <remarks/>
public object f;
/// <remarks/>
public object g;
/// <remarks/>
public object h;
/// <remarks/>
public object i;
/// <remarks/>
public object j;
}
示例XML:
<z id="Fo">
<attributes>
<Relation>1<Relation>
<YVersion>16<YVersion>
<W>
<a>1</a>
<b>2</b>
<c>3</c>
<d>4</d>
</W>
</attributes>
</z>
當我調試,我與所有反序列化的XML對象,直到節點VV,包括節點VV的所有節點並且它是參數,但是下面的節點不是以某種方式反序列化的,在這種情況下節點A,B,C和D.
Regards,
Hugo
我建議你谷歌「XML到模型C#」你會發現比XSD更好的創造者。他們在線。 – r1verside