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