Hello
I'm trying to generate xml output (based on a class) that looks like this:
<cdsXMLEnvelope>
<TestValue1>x1</TestValue1>
  <inner>
    <eTestValue1>e1</eTestValue1>
  </inner>
  <inner>
    <eTestValue1>e1</eTestValue1>
  </inner>
  <inner>
    <eTestValue1>e1</eTestValue1>
  </inner>
</cdsXMLEnvelope>
[System.Xml.Serialization.XmlRootAttribute("cdsXMLEnvelope", Namespace = "",       IsNullable = false)]
[XmlTypeAttribute(Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
//public class cdsXMLEnvelope : cdsXMLinfo
public class cdsXMLEnvelope
{
    [XmlElementAttribute(ElementName = "eTestValue1")]
    public string eTestValue1 { get; set; }
    [System.Xml.Serialization.XmlArrayItem("inner")]
    public cdsXMLinfo[] cdsXMLinfo { get; set; }
}
//[XmlTypeAttribute(Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public class cdsXMLinfo
{
    [XmlElementAttribute(ElementName = "TestValue1")]
    public string TestValue1 { get; set; }
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string TestValue3 { get; set; }
}
please help me hook this code up, change the class etc-- I keep trying a variety of ways & I get object not found & misc errors when trying to serialize it to xml
also can I avoid using an array for the inner elements? do I use lists?
I'll try to refine this question as we go, I know people hate these long ?'s
Thanks!!
         {
                cdsXMLEnvelope x = new cdsXMLEnvelope();
                x.eTestValue1 = "x1"; 
                x.cdsXMLinfo = new cdsXMLinfo[1];
                x.cdsXMLinfo[0].TestValue1 = "xi1";
                //x.cdsXMLinner[0].TestValue1 = "xi2";             
                XmlSerializer writer = new XmlSerializer(x.GetType());
                StreamWriter file = new StreamWriter("x.xml");
                writer.Serialize(file, x);
                file.Close();
        }