Handle arrays in C# generating xml?

Crimson_Might

New Member
I got a generated class in C# (from a xsd with xsd/c), that got this declaration (together with string-fields, numeric fields and so):\[code\]private string[] itemsField;private ItemsChoiceType[] itemsElementNameField; \[/code\]The ItemsChoiceType looks like this: \[code\]public enum ItemsChoiceType1 { colorOfCar, colorOfMC, colorOfBike,}\[/code\]So, If we look at the itemsElementNameField, its an array of enums, but how should I fill it, to make every value as an element in my XML-file?(The method I use to create the xml is:\[code\] - XmlSerializer XmlSerRoot = new XmlSerializer(typeof(RootInformation)) (the root of my xml!) - StringWriterWithEncoding strWriter = new StringWriterWithEncoding(Encoding.GetEncoding("iso-8859-1")); - XmlDocument documentInXML = new XmlDocument(); - XmlSerRoot.Serialize(strWriter, rootInformation); - string XmlString; - XmlString = strWriter.ToString(); - documentInXML.LoadXml(XmlString); - documentInXML.Save(myPath);\[/code\]maybe not of interest, but better to apply some information about it, I thought)

I want this array to be like an ordinary xml-tag in the file, like: \[code\]<colorOfCar>Blue</colorOfCar>\[/code\]I got all information I need, like if it's a colorOfCar, and the color of it (like blue). But how should the array look like? I mean, how should I fill it to be ok. It's not working with just something like \[code\]ItemsChoiceType[1] = "colorOfCar"\[/code\] (I got this info at this stage). But I cannot figure out how the array should be filled to be ok in the end.Maybe kind of incomplete information, but I think you undertand what I mean....The main thing is: how to fill an array to be represented as xml-elements in the end.Regards,/E
 
Back
Top