Handle arrays in C# generating xml? -
i got generated class in c# (from xsd xsd/c), got declaration (together string-fields, numeric fields , so):
private string[] itemsfield; private itemschoicetype[] itemselementnamefield;
the itemschoicetype looks this:
public enum itemschoicetype1 { colorofcar, colorofmc, colorofbike, }
so, if @ itemselementnamefield, array of enums, how should fill it, make every value element in xml-file?
(the method use create xml is:
- xmlserializer xmlserroot = new xmlserializer(typeof(rootinformation)) (the root of 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, better apply information it, thought)
want array ordinary xml-tag in file, like: <colorofcar>blue</colorofcar>
i got information need, if it's colorofcar, , color of (like blue). how should array like? mean, how should fill ok. it's not working itemschoicetype[1] = "colorofcar"
(i got info @ stage). cannot figure out how array should filled ok in end.
maybe kind of incomplete information, think undertand mean.... main thing is: how fill array represented xml-elements in end.
regards, /e
i had no choise follow xsd, got in hand 3.rd part. that's why looks bit confusing. solution easier thought. don't know how work, id does. filled in arrays enums, , looks nice. other array keep values.
kind of strange it's ok, works.
/e
Comments
Post a Comment