コード例 #1
0
        private void ProcessEditionListFeed(PageDataCollection editions)
        {
            XmlDocument doc = new XmlDocument();

            XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(declaration);

            XmlNode outerNode = doc.CreateElement("editionList");
            doc.AppendChild(outerNode);

            XmlNode pageIdNode = doc.CreateElement("pageId");
            pageIdNode.InnerText = editionListPage.PageGuid.ToString();
            outerNode.AppendChild(pageIdNode);

            XmlNode titleNode = doc.CreateElement("title");
            titleNode.InnerText = editionListPage.PageName;
            outerNode.AppendChild(titleNode);

            XmlNode updatedNode = doc.CreateElement("updated");
            updatedNode.InnerText = editions.Count == 0 ? "1970-01-01" : editions.Max(pd => pd.StartPublish).ToString("o");
            outerNode.AppendChild(updatedNode);

            XmlNode authorNameNode = doc.CreateElement("authorname");
            authorNameNode.InnerText = editionListPage.CreatedBy;
            outerNode.AppendChild(authorNameNode);

            XmlNode hrefNode = doc.CreateElement("href");
            hrefNode.InnerText = string.Format("{0}/{1}.xml", Common.GetRootPublishLocationPath(), editionListPage.Name);
            outerNode.AppendChild(hrefNode);

            foreach (PageData edition in editions)
            {
                CreateEditionList(doc, edition, outerNode);
            }

            ApplyEditionListTransform(doc.InnerXml); ;
        }