मैं मुसीबत यह पता लगाना रही है, इसलिए मैं एक xml चादर है कि इसएक्सएमएल क्रमबद्धता सरणी
<root>
<list id="1" title="One">
<word>TEST1</word>
<word>TEST2</word>
<word>TEST3</word>
<word>TEST4</word>
<word>TEST5</word>
<word>TEST6</word>
</list>
<list id="2" title="Two">
<word>TEST1</word>
<word>TEST2</word>
<word>TEST3</word>
<word>TEST4</word>
<word>TEST5</word>
<word>TEST6</word>
</list>
</root>
की तरह लग रहा है और मैं में
public class Items
{
[XmlAttribute("id")]
public string ID { get; set; }
[XmlAttribute("title")]
public string Title { get; set; }
//I don't know what to do for this
[Xml... something]
public list<string> Words { get; set; }
}
//I don't this this is right either
[XmlRoot("root")]
public class Lists
{
[XmlArray("list")]
[XmlArrayItem("word")]
public List<Items> Get { get; set; }
}
//Deserialize XML to Lists Class
using (Stream s = File.OpenRead("myfile.xml"))
{
Lists myLists = (Lists) new XmlSerializer(typeof (Lists)).Deserialize(s);
}
मैं इसे क्रमानुसार करने कोशिश कर रहा हूँ एक्सएमएल और एक्सएमएल सीरियलाइजिंग के साथ वास्तव में नया है, किसी भी मदद की बहुत सराहना की जाएगी
उपयोग XmlArray अपनी कक्षाओं की घोषणा काम करना चाहिए – sll
बस नोट का एक बिंदु, यदि आप XML को ऑब्जेक्ट्स में परिवर्तित कर रहे हैं, तो यह Deserializing है। ऑब्जेक्ट्स को एक्सएमएल में कनवर्ट करना (या किसी अन्य प्रारूप जिसे डिस्क या नेटवर्क स्टीम पर भेजा जा सकता है) क्रमबद्ध है। – MCattle