private AdferoArticle GetArticleFromXmlString(string xml) { AdferoArticle article = new AdferoArticle(); Dictionary <string, string> fields = new Dictionary <string, string>(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNodeList children = doc.SelectNodes("//article/node()"); foreach (XmlNode n in children) { switch (n.Name) { case "id": article.Id = int.Parse(n.InnerText); break; case "briefId": article.FeedId = int.Parse(n.InnerText); break; case "state": article.State = n.InnerText; break; case "fields": foreach (XmlNode f in n.ChildNodes) { article.Fields.Add(f.Attributes["name"].Value, f.InnerText); } break; default: break; } } return(article); }
private AdferoArticle GetArticleFromXmlString(string xml) { AdferoArticle article = new AdferoArticle(); Dictionary<string, string> fields = new Dictionary<string, string>(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNodeList children = doc.SelectNodes("//article/node()"); foreach (XmlNode n in children) { switch (n.Name) { case "id": article.Id = int.Parse(n.InnerText); break; case "briefId": article.FeedId = int.Parse(n.InnerText); break; case "state": article.State = n.InnerText; break; case "fields": foreach (XmlNode f in n.ChildNodes) article.Fields.Add(f.Attributes["name"].Value, f.InnerText); break; default: break; } } return article; }