コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }