public override List <ItemDataClass> ParseXML() { List <ItemDataClass> itemDataClass = new List <ItemDataClass>(); string xmlUrl = _url; string xmlURL = _url; using (XmlTextReader xmlReader = new XmlTextReader(xmlURL)) { string url = ""; List <string> simulationList = new List <string>(); while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { switch (xmlReader.Name) { case "url": url = xmlReader.ReadInnerXml(); break; case "simulation": simulationList.Add(xmlReader.ReadInnerXml()); break; } } } SettingsItemData settingItemData = new SettingsItemData(url, simulationList); itemDataClass.Add(settingItemData); } return(itemDataClass); }
protected override void BackgroundWorkerDoWork(object sender, DoWorkEventArgs args) { List <ItemDataClass> itemDataClass = new List <ItemDataClass>(); string xmlURL = _url; using (XmlTextReader xmlReader = new XmlTextReader(xmlURL)) { string url = ""; List <string> simulationList = new List <string>(); while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { switch (xmlReader.Name) { case "url": url = xmlReader.ReadInnerXml(); break; case "simulation": simulationList.Add(xmlReader.ReadInnerXml()); break; } } } SettingsItemData settingItemData = new SettingsItemData(url, simulationList); itemDataClass.Add(settingItemData); args.Result = itemDataClass; } }
public ElementItemDataParsing(SettingsItemData settingItemData) { _SettingItemData = settingItemData; }