Hai All i want to create an XML file with following format
<myFiles>
<name>myname</name>
<place>myplace</place>
<mydata>
<today>1-1-2011</today>
<time>1 PM</time>
<driving>
<car>audi</car>
<bus>volvo</bus>
</driving>
</mydata>
<mydata>
<today>1-1-2011</today>
<time>1 PM</time>
<driving>
<car>audi</car>
<bus>volvo</bus>
</driving>
</mydata>
</myFiles>
For creating this i am using
class myfile
{
public string name {get;set;}
public string place {get;set;}
public list<mydata> mydata {get;set;}
}
then also public claa mydata { ...... } fro XML building i am using
static public void SerializeToXMLList(List<Movie> movies)
{
XmlSerializer serializer = new XmlSerializer(typeof(List<Movie>));
TextWriter textWriter = new StreamWriter(@"C:\movie.xml");
serializer.Serialize(textWriter, movies);
textWriter.Close();
}
But it will give me output like
<myFiles>
<name>myname</name>
<place>myplace</place>
<mydata>
<mydata>
<today>1-1-2011</today>
<time>1 PM</time>
<driving>
<car>audi</car>
<bus>volvo</bus>
</driving>
</mydata>
<mydata>
<today>1-1-2011</today>
<time>1 PM</time>
<driving>
<car>audi</car>
<bus>volvo</bus>
</driving>
</mydata>
</mydata>
</myFiles>
so there was number of list with in mydata list with class name
How can i avoid that..., If any one knw pls help me..