これは私のサービスのxml出力です。
<LifeAreas>
<Overall i:nil="true"/>
<Career>
<Good>
<NamePlanet/>
<NamePlanet/>
</Good>
<Neutral>
<NamePlanet/>
<NamePlanet/>
<NamePlanet/>
</Neutral>
<Bad>
<NamePlanet/>
<NamePlanet/>
<NamePlanet/>
<NamePlanet/>
</Bad>
</Career>
<Finance i:nil="true"/>
<Relationship i:nil="true"/>
<Health i:nil="true"/>
使用される DataContract は以下のとおりです。
[DataContract(Name = "Areas", Namespace = "")]
public sealed class Areas
{
[DataMember(Name = "Overall", Order = 0)]
public PlanetDiginity Overall { get; set; }
[DataMember(Name = "Career", Order = 1)]
public PlanetDiginity Career { get; set; }
[DataMember(Name = "Finance", Order = 2)]
public PlanetDiginity Finance { get; set; }
[DataMember(Name = "Relationship", Order = 3)]
public PlanetDiginity Relationship { get; set; }
[DataMember(Name = "Health", Order = 4)]
public PlanetDiginity Health { get; set; }
}
[DataContract(Name = "NamePlanet", Namespace = "")]
public sealed class NamePlanet
{
public string PlanetName { get; set; }
}
[DataContract(Name = "PlanetDiginity", Namespace = "")]
public sealed class PlanetDiginity
{
///<summary>
/// Gets and Sets the Planet Diginity
/// </summary>
[DataMember(Name = "Good", Order = 0)]
public List<NamePlanet> Good { get; set; }
[DataMember(Name = "Neutral", Order = 1)]
public List<NamePlanet> Neutral { get; set; }
[DataMember(Name = "Bad", Order = 2)]
public List<NamePlanet> Bad { get; set; }
}
[DataContract(Name = "GoodBadPlanetList", Namespace = "")]
public sealed class GoodBadPlanetList
{
[DataMember(Name = "GoodBadPlanetReport", Order = 2)]
public List<GoodBadPlanetReport> GoodBadPlanetReport { get; set; }
[DataMember(Name = "AstroDetails", Order = 0)]
public AstroInfo AstroDetails { get; set; }
[DataMember(Name = "LifeAreas", Order = 1)]
public Areas LifeAreas { get; set; }
}
Web サービスから、必要なデータがノードに入っていますが、xml には表示されていません。それだけがリストの数だけプロパティ名を表示しています。