views:

25

answers:

0

When I do like this

[XmlType("c1")]
[XmlRoot("c1")]
public class Class1
{
    [XmlArray("items")]
    [XmlArrayItem("c2")]
    public Class2[] Items;
}
[XmlType("c2")]
public class Class2
{
    [XmlAttribute("name")]
    public string Name;
}

I get this

  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/"&gt;
      <c1>
        <items>
          <c2 name="string" />
          <c2 name="string" />
        </items>
      </c1>
    </HelloWorld>
  </soap:Body>

but When i go One level deeper and do

  [XmlRoot("c3")]
    public class Class3
    {
        [XmlElement("c1")]
        public Class1 Name;
    } 


  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/"&gt;
      <c3>
        <c1>
          <items>
            <c2 xsi:nil="true" />
            <c2 xsi:nil="true" />
          </items>
        </c1>
      </c3>
    </HelloWorld>
  </soap:Body>

I am missing the name="string" attribute Can someone help on this?