コード例 #1
0
        public BlogPost(XElement xmlDoc)
            : base(xmlDoc)
        {
            Title          = xmlDoc.GetField("title");
            Image          = null;
            Summary        = xmlDoc.GetField("summary");
            Body           = xmlDoc.GetField("body");
            Author         = xmlDoc.GetMultiListField("author");
            PublishingDate = xmlDoc.GetField("publish") ?? xmlDoc.GetField("publish date");

            var tagsField     = xmlDoc.GetMultiListField("tags");
            var categoryField = xmlDoc.GetMultiListField("category");

            if (tagsField != null)
            {
                Tags = tagsField;
                if (categoryField != null)
                {
                    Tags.AddItemsFromMultiListField(categoryField);
                }
            }
            else
            {
                Tags = categoryField;
            }

            SearchTitle       = xmlDoc.GetField("title");
            SearchDescription = xmlDoc.GetField("summary");
            SearchImage       = null;
            BrowserTitle      = xmlDoc.GetField("browser title");
            ParseMetaTags(xmlDoc.GetField("meta tags")?.Value);
            ImageReferences = new List <string>();
            ParseBodyForImageReferences();
        }