Hi. 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):
private string[] itemsField;
private ItemsChoiceType[] itemsElementNameField;
The ItemsChoiceType looks like this:
public enum ItemsChoiceType1 {
colorOfCar,
colorOfMC,
colorOfBike,
}
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:
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);
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: <colorOfCar>Blue</colorOfCar>
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 ItemsChoiceType[1] = "colorOfCar" (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