示例#1
0
        /// <summary>
        /// Before trying to generate document to XML it is checked if content is to be generated.
        /// </summary>
        /// <param name="it">Document to process</param>
        /// <returns>TRUE if document can be written to XML</returns>
        private bool IsValidOldDocument(Doc docInfo, IterwebMapInfo it) {
            Boolean rslt = true;

            if (it.OldDocTemplateType == TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_003) {
                // Bypass check as content is already valid.
                return rslt;
            }
            else {
                switch (it.OldDocTemplateType) {
                    case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_002:
                        if (docInfo.NewsGrouper.Count == 0 && docInfo.DocumentText.Content == "") {
                            rslt = false;
                        }
                        break;
                    case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_005:
                        if (docInfo.PhotoGallery.Count == 0 && docInfo.DocumentText.Content == "") {
                            rslt = false;
                        }
                        break;
                    default:
                        if (docInfo.DocumentText.Content == "") {
                            rslt = false;
                        }
                        break;
                }
            }

            if (!rslt) {
                it.Processed = 17;
            }
            return rslt;
        }
示例#2
0
        /// <summary>
        /// Appends document content if output is new Article XML format.
        /// </summary>
        /// <param name="documentPath">Resource target directory</param>
        /// <param name="iterDoc">XML Document</param>
        /// <param name="iterArticleContent">Xml Document Node</param>
        /// <param name="doc">Database object being processed</param>
        /// <param name="info">Doc under examination</param>
        /// <param name="articleNum">Num article being processed</param>
        private void CreateOutputArticleContentDocToXml(string documentPath, XmlDocument iterDoc, XmlElement iterArticleContent, IterwebMapInfo doc, Doc info, long articleNum) {
            if (log.IsDebugEnabled) log.Debug("CreateOutputArticleContentDocToXml start (Old Doc processing)");
            XmlElement item = null;
            XmlElement itemChild = null;
            XmlCDataSection cdata = null;
            string contentText = "";
            string docGlobalRef = "/bin/";
            string fileName = "";

            switch (info.TemplateType) {
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_001:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    if (info.Bullet.Count != 0) {
                        contentText = "";
                        contentText += "<ul>";
                        foreach (var bulletItem in info.Bullet) {
                            contentText += "<li>" + bulletItem.Content + "</li>";
                        }
                        contentText += "</ul>";
                    }
                    contentText += info.DocumentText.Content + "<br><br>";
                    foreach (var rh in info.ReaderHelp) {
                        contentText += "<b>" + rh.NameTitleContent + "</b><br>";
                        contentText += rh.NameTextContent + "<br>";
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    foreach (var pr in info.PhotoRelated) {
                        fileName = ExtractImageNamePart(pr.ImageSrc);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {
                            // An image file reference.
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                            iterArticleContent.AppendChild(item);


                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);

                            itemChild = iterDoc.CreateElement("component");
                            itemChild.SetAttribute("name", "Cutline");
                            contentText = pr.Footer;
                            contentText = RemoveInvalidXmlChars(contentText);
                            cdata = iterDoc.CreateCDataSection(contentText);
                            itemChild.InnerXml = cdata.OuterXml;
                            item.AppendChild(itemChild);
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_002:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    // Process the NewsGrouper only list.
                    contentText = "";
                    foreach (var ng in info.NewsGrouper) {
                        contentText += "<p>" + ng.TitleContent + "</p>";
                        contentText += "<p>" + ng.TextContent + "</p><hr>";
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_003:
                    // Process the CartoonGrouper only list.
                    foreach (var cg in info.CartoonGrouper) {
                        item = iterDoc.CreateElement("component");
                        item.SetAttribute("name", "Headline");
                        item.SetAttribute("index", "1");
                        iterArticleContent.AppendChild(item);

                        contentText = cg.TitleContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        item.InnerXml = cdata.OuterXml;

                        fileName = ExtractImageNamePart(cg.TextContent);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {
                            // An image file reference.
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_TOON);
                            iterArticleContent.AppendChild(item);

                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);

                            itemChild = iterDoc.CreateElement("component");
                            itemChild.SetAttribute("name", "Cutline");
                            contentText = cg.AuthorContent;
                            contentText = RemoveInvalidXmlChars(contentText);
                            cdata = iterDoc.CreateCDataSection(contentText);
                            itemChild.InnerXml = cdata.OuterXml;
                            item.AppendChild(itemChild);
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_004:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = "";
                    contentText = info.DocumentText.Content + "<br><br>";
                    foreach (var rh in info.ReaderHelp) {
                        contentText += "<b>" + rh.NameTitleContent + "<b>";
                        contentText += rh.NameTextContent + "<br>";
                    }
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Byline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "City");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    if (info.Bullet.Count != 0) {
                        contentText = "<ul>";
                        foreach (var bulletItem in info.Bullet) {
                            contentText += "<li>" + bulletItem.Content + "</li>";
                        }
                        contentText += "</ul>";
                        item = iterDoc.CreateElement("component");
                        item.SetAttribute("name", "Lead");
                        item.SetAttribute("index", "1");
                        iterArticleContent.AppendChild(item);

                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        item.InnerXml = cdata.OuterXml;
                    }
                    foreach (var pr in info.PhotoRelated) {
                        // An image file reference.
                        if (pr.ImageSrc != "") {
                            fileName = ExtractImageNamePart(pr.ImageSrc);
                            fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                            if (fileName != "") {
                                item = iterDoc.CreateElement("component");
                                item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                                iterArticleContent.AppendChild(item);

                                contentText = docGlobalRef + fileName;
                                contentText = RemoveInvalidXmlChars(contentText);

                                itemChild = iterDoc.CreateElement("file");
                                itemChild.SetAttribute("path", contentText);
                                item.AppendChild(itemChild);

                                itemChild = iterDoc.CreateElement("component");
                                itemChild.SetAttribute("name", "Cutline");
                                contentText = pr.Footer;
                                contentText = RemoveInvalidXmlChars(contentText);
                                cdata = iterDoc.CreateCDataSection(contentText);
                                itemChild.InnerXml = cdata.OuterXml;
                                item.AppendChild(itemChild);
                            }
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_005:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    foreach (var pg in info.PhotoGallery) {
                        fileName = ExtractImageNamePart(pg.PhotoBigContent);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {
                            // An image file reference.
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                            iterArticleContent.AppendChild(item);

                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);

                            contentText = "";
                            contentText += pg.PhotoCreditContent;
                            if (pg.PhotoFooterContent != "") {
                                contentText += " - " + pg.PhotoFooterContent;
                            }
                            if (contentText != "") {
                                itemChild = iterDoc.CreateElement("component");
                                itemChild.SetAttribute("name", "Cutline");
                                contentText = RemoveInvalidXmlChars(contentText);
                                cdata = iterDoc.CreateCDataSection(contentText);
                                itemChild.InnerXml = cdata.OuterXml;
                                item.AppendChild(itemChild);
                            }
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_006:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    contentText = "";
                    if (info.Bullet.Count != 0) {
                        contentText += "<ul>";
                        foreach (var it in info.Bullet) {
                            contentText += "<li>" + it.Content + "</li>";
                        }
                        contentText += "</ul>";
                    }

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText += info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_007:
                    // COQ: Jul.01/2014 - All records discarded, not processed.
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_008:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    contentText = "";
                    if (info.Bullet.Count != 0) {
                        contentText += "<ul>";
                        foreach (var bulletItem in info.Bullet) {
                            contentText += "<li>" + bulletItem.Content + "</li>";
                        }
                        contentText += "</ul>";
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText += info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    foreach (var pr in info.PhotoRelated) {
                        fileName = ExtractImageNamePart(pr.ImageSrc);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {

                            // An image file reference.
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                            iterArticleContent.AppendChild(item);


                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);

                            itemChild = iterDoc.CreateElement("component");
                            itemChild.SetAttribute("name", "Cutline");
                            contentText = pr.Footer;
                            contentText = RemoveInvalidXmlChars(contentText);
                            cdata = iterDoc.CreateCDataSection(contentText);
                            itemChild.InnerXml = cdata.OuterXml;
                            item.AppendChild(itemChild);
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_009:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    contentText = "";
                    if (info.Bullet.Count != 0) {
                        contentText += "<ul>";
                        foreach (var bulletItem in info.Bullet) {
                            contentText += "<li>" + bulletItem.Content + "</li>";
                        }
                        contentText += "<ul>";
                    }

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText += info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Byline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "City");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_010:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    if (info.PhotoRelated.Count != 0) {
                        // An image file reference.
                        foreach (var pr in info.PhotoRelated) {
                            fileName = ExtractImageNamePart(pr.ImageSrc);
                            fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                            if (fileName != "") {

                                item = iterDoc.CreateElement("component");
                                item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                                iterArticleContent.AppendChild(item);

                                contentText = docGlobalRef + fileName;
                                contentText = RemoveInvalidXmlChars(contentText);
                                itemChild = iterDoc.CreateElement("file");
                                itemChild.SetAttribute("path", contentText);
                                item.AppendChild(itemChild);

                                itemChild = iterDoc.CreateElement("component");
                                itemChild.SetAttribute("name", "Cutline");
                                contentText = pr.Footer;
                                contentText = RemoveInvalidXmlChars(contentText);
                                cdata = iterDoc.CreateCDataSection(contentText);
                                itemChild.InnerXml = cdata.OuterXml;
                                item.AppendChild(itemChild);
                            }
                        }
                    }
                    if (info.ImageOnlySet.Content != "" && info.PhotoRelated.Count == 0) {
                        fileName = ExtractImageNamePart(info.ImageOnlySet.Content);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                            iterArticleContent.AppendChild(item);

                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);
                        }
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_011:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Byline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "City");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_012:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_013:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Byline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "City");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    // An image file reference.
                    fileName = ExtractImageNamePart(info.ImageOnlySet.Content);
                    fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                    if (fileName != "") {
                        item = iterDoc.CreateElement("component");
                        item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                        iterArticleContent.AppendChild(item);

                        contentText = docGlobalRef + fileName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        itemChild = iterDoc.CreateElement("file");
                        itemChild.SetAttribute("path", contentText);
                        item.AppendChild(itemChild);
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_014:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }
                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Byline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "City");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_015:
                    contentText = "";
                    foreach (var tit in info.Title) {
                        contentText += tit.Content;
                    }

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Headline");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    item = iterDoc.CreateElement("component");
                    item.SetAttribute("name", "Text");
                    item.SetAttribute("index", "1");
                    iterArticleContent.AppendChild(item);

                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    item.InnerXml = cdata.OuterXml;

                    foreach (var pr in info.PhotoFooterGallery.PhotoList) {
                        fileName = ExtractImageNamePart(pr.ImageSrc);
                        fileName = CopyImageToZip(_se4MediaSourceFolder, documentPath, fileName, doc);
                        if (fileName != "") {
                            // An image file reference.
                            item = iterDoc.CreateElement("component");
                            item.SetAttribute("name", GlobalConstants.IMAGE_NAME_GENERAL);
                            iterArticleContent.AppendChild(item);

                            contentText = docGlobalRef + fileName;
                            contentText = RemoveInvalidXmlChars(contentText);
                            itemChild = iterDoc.CreateElement("file");
                            itemChild.SetAttribute("path", contentText);
                            item.AppendChild(itemChild);

                            itemChild = iterDoc.CreateElement("component");
                            itemChild.SetAttribute("name", "Cutline");
                            contentText = "";
                            contentText += info.PhotoFooterGallery.FoooterTitle + " - " + info.PhotoFooterGallery.Footer;
                            contentText = RemoveInvalidXmlChars(contentText);
                            cdata = iterDoc.CreateCDataSection(contentText);
                            itemChild.InnerXml = cdata.OuterXml;
                            item.AppendChild(itemChild);
                        }
                    }
                    break;
            }
            if (log.IsDebugEnabled) log.Debug("CreateOutputArticleContentDocToXml end (Old Doc processing)");
        }
示例#3
0
        /// <summary>
        /// If output structure is 2, it creates all of the xml elements to document.
        /// </summary>
        /// <param name="isOldDoc">OldDoc or SE4 doc</param>
        /// <param name="documentPath">Target directory for resources</param>
        /// <param name="iterDoc">XML main node</param>
        /// <param name="iterArticles">XML node to articles</param>
        /// <param name="it">Record info</param>
        /// <param name="title">Document title</param>
        /// <param name="examinedDoc">Old Doc under examination. Optional</param>
        /// <param name="articleNum">Number or article being processed. Optional.</param>
        private void CreateOutputArticleDocToXml(bool isOldDoc, string documentPath, XmlDocument iterDoc, XmlElement iterArticles, IterwebMapInfo it, string title, Doc examinedDoc = null, long articleNum = 0) {
            if (log.IsDebugEnabled) log.Debug("CreateOutputArticleDocToXml start");
            XmlElement iterArticle = iterDoc.CreateElement("article");
            XmlElement iterArticleMetadata = iterDoc.CreateElement("metadata");
            XmlElement iterArticleContent = iterDoc.CreateElement("content");

            XmlElement properties = iterDoc.CreateElement("properties");
            properties.SetAttribute("indexable", "1");
            properties.SetAttribute("urltitle", RemoveInvalidXmlChars(it.UrlPath.ExtractUrlTitle()));
            properties.SetAttribute("legacyurl", RemoveInvalidXmlChars(it.UrlPath));
            properties.SetAttribute("title", RemoveInvalidXmlChars(title));
            properties.SetAttribute("createdate", String.Format("{0:yyyy/MM/dd HH:mm:ss}", it.DisplayDate));
            properties.SetAttribute("modifieddate", String.Format("{0:yyyy/MM/dd HH:mm:ss}", it.UpdateDate));
            iterArticleMetadata.AppendChild(properties);

            iterArticle.AppendChild(iterArticleMetadata);
            iterArticle.AppendChild(iterArticleContent);

            if (isOldDoc) {
                iterArticle.SetAttribute("articleid", it.IDOldDoc);
            }
            else {
                iterArticle.SetAttribute("articleid", it.IDSE4ArticleId);
            }

            string filter = "";
            string filterEx = "";
            filter = GlobalConstants.ARTICLE_HISTORICAL_GENERAL;

            if (isOldDoc) {
                switch (examinedDoc.TemplateType) {
                    case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_003:
                        filter = GlobalConstants.ARTICLE_HISTORICAL_TOON_GALLERY;
                        break;
                    default:
                        break;
                }
            }
            else {
                if (it.Layout == "creacion_infografias") {
                    filter = GlobalConstants.ARTICLE_HISTORICAL_GENERAL;
                }
                if (it.Layout == "creacion_galeria") {
                    filter = GlobalConstants.ARTICLE_HISTORICAL_IMAGE_GALLERY;
                }
                if (it.IdBrightCove != null) {
                    if (it.Layout == "creacion_video") {
                        filter = GlobalConstants.ARTICLE_HISTORICAL_VIDEO_GALLERY;
                    }
                    else {
                        if (it.Layout == "creacion_notaInterior100" || it.Layout == "creacion_notaInterior100M") {
                            filter = GlobalConstants.ARTICLE_HISTORICAL_GENERAL;
                            filterEx = GlobalConstants.ARTICLE_HISTORICAL_VIDEO_GALLERY;
                        }
                    }
                }
                if (it.IsInfographic == 1) {
                    filterEx = GlobalConstants.ARTICLE_HISTORICAL_INFOGRAPHIC_GALLERY;
                    filter = GlobalConstants.ARTICLE_HISTORICAL_GENERAL;
                }
            }
            CreateOutputArticleSectionsDocToXml(iterDoc, iterArticleMetadata, it.DisplayDate, filter, filterEx);
            if (isOldDoc) {
                CreateOutputArticleContentDocToXml(documentPath, iterDoc, iterArticleContent, it, examinedDoc, articleNum);
            }
            else {
                CreateOutputArticleCategoriesDocToXml(iterDoc, iterArticleMetadata, it.IdObjetoSE);

                // Retrieve Document Attributes and filter to use those enabled to do so.
                List<SE4Attribute> docSE4AttrList = LoadSE4DocItems(it.IdObjetoSE, it.Layout);
                CreateOutputArticleContentDocToXml(documentPath, iterDoc, iterArticleContent, it, docSE4AttrList);
            }
            iterArticles.AppendChild(iterArticle);
            if (log.IsDebugEnabled) log.Debug("CreateOutputArticleDocToXml end");
        }
示例#4
0
        /// <summary>
        /// Locates first CartoonGrouper file and extracts its modified date and sets it as the new CreateDate/ModifiedDate for 
        /// record.
        /// </summary>
        /// <remarks>Be specially cautious as the 'it' create/modify date is not persisted back to database.</remarks>
        /// <param name="it">Record to update</param>
        /// <param name="examinedDoc">Json Converted data.</param>
        private void UpdateOldDocToonCreateDate(IterwebMapInfo it, Doc examinedDoc) {
            if (log.IsDebugEnabled) {
                log.Debug("UpdateOldDocToonCreateDate Start");
            }

            //Se4MediaSourceFolder
                
            string fileNamePath = "";
            foreach (var cg in examinedDoc.CartoonGrouper) {
                fileNamePath = _se4MediaSourceFolder + "\\" + ExtractImageNamePart(cg.TextContent);
                DateTime dt = new DateTime(1900, 01, 01); // If file does not exist, sets this date. Used for OLD docs scanning.
                if (File.Exists(fileNamePath)) {
                    dt = File.GetLastWriteTime(fileNamePath);                    
                }
                it.DisplayDate = it.UpdateDate = dt;
            }            
            if (log.IsDebugEnabled) {
                log.Debug("UpdateOldDocToonCreateDate End");
            }
        }
示例#5
0
        /// <summary>
        /// Saves an old document structure to its XML file used in ITERWEB migration processing.
        /// </summary>
        /// <param name="contentPath">File System path to create the docuemnt</param>
        /// <param name="documentPath">File System path to create images</param>
        /// <param name="info">Document info</param>
        /// <param name="articleNum">Id for document to save</param>
        private void CreateDocumentAttributesToXml(string contentPath, string documentPath, Doc info, long articleNum) {
            if (log.IsDebugEnabled) log.Debug("CreateDocumentAttributesToXml start (Old Doc processing)");
            XmlCDataSection cdata = null;
            XmlDocument iterDoc = null;
            XmlElement item = null;
            XmlElement itemContent;
            string contentText;
            int i = 1;
            int itemNum = 1;
            string docGlobalRef = DocumentImageDir;
            iterDoc = new XmlDocument();
            XmlDeclaration iterDocDeclaration = iterDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
            XmlElement rootIter = iterDoc.CreateElement("root");
            iterDoc.PreserveWhitespace = false;
            iterDoc.AppendChild(rootIter);
            iterDoc.InsertBefore(iterDocDeclaration, rootIter);
            switch (info.TemplateType) {
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_001:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var bulletItem in info.Bullet) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", bulletItem.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = bulletItem.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }

                    itemNum = 1;
                    foreach (var pr in info.PhotoRelated) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pr.ImageName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "");
                        rootIter.AppendChild(item);

                        var imageName = docGlobalRef + ExtractImageNamePart(pr.ImageSrc);
                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", pr.FooterName);
                        itemChild.SetAttribute("type", "text");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = pr.Footer;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);
                        itemNum++;
                    }

                    itemNum = 1;
                    foreach (var rh in info.ReaderHelp) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", rh.NameTitle + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = rh.NameTitleContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", rh.NameText + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = rh.NameTextContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_002:
                    // Process the NewsGrouper only list.
                    itemNum = 1;
                    foreach (var ng in info.NewsGrouper) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", ng.TitleName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = ng.TitleContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", ng.TextName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = ng.TextContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_003:
                    // Process the CartoonGrouper only list.
                    itemNum = 1;
                    foreach (var cg in info.CartoonGrouper) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", cg.TitleName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = cg.TitleContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", cg.TextName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "");
                        rootIter.AppendChild(item);

                        var imageName = docGlobalRef + ExtractImageNamePart(cg.TextContent);
                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", cg.AuthorName); // Actually, Footer
                        itemChild.SetAttribute("type", "text");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = cg.AuthorContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_004:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.AuthorName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.CityName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.DisplayDateName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.DisplayDateText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var bulletItem in info.Bullet) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", bulletItem.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = bulletItem.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }

                    itemNum = 1;
                    foreach (var pr in info.PhotoRelated) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pr.ImageName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "");
                        rootIter.AppendChild(item);

                        var imageName = "";
                        itemContent = iterDoc.CreateElement("dynamic-content");
                        if (pr.ImageSrc != "") {
                            imageName = docGlobalRef + ExtractImageNamePart(pr.ImageSrc);
                        }

                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", pr.FooterName);
                        itemChild.SetAttribute("type", "text");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = pr.Footer;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);
                        itemNum++;
                    }

                    itemNum = 1;
                    foreach (var rh in info.ReaderHelp) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", rh.NameTitle + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = rh.NameTitleContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", rh.NameText + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = rh.NameTextContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_005:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var pg in info.PhotoGallery) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pg.PhotoBigName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        var imageName = docGlobalRef + ExtractImageNamePart(pg.PhotoBigContent);
                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pg.PhotoSmallName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        imageName = docGlobalRef + ExtractImageNamePart(pg.PhotoSmallContent);
                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pg.PhotoCreditName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = pg.PhotoCreditContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);

                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pg.PhotoFooterName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = pg.PhotoFooterContent;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_006:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_007:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.ImageOnlySet.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    var imageNameOnly = docGlobalRef + ExtractImageNamePart(info.ImageOnlySet.Content);
                    var itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "High");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Medium");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Low");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var bulletItem in info.Bullet) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", bulletItem.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = bulletItem.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_008:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var bulletItem in info.Bullet) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", bulletItem.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = bulletItem.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }

                    itemNum = 1;
                    foreach (var pr in info.PhotoRelated) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pr.ImageName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "");
                        rootIter.AppendChild(item);

                        var imageName = docGlobalRef + ExtractImageNamePart(pr.ImageSrc);
                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", pr.FooterName);
                        itemChild.SetAttribute("type", "text");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = pr.Footer;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);
                        itemNum++;
                    }
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_009:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var bulletItem in info.Bullet) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", bulletItem.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = bulletItem.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.AuthorName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.CityName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.DisplayDateName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.DisplayDateText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;
                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_010:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.ImageOnlySet.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    imageNameOnly = docGlobalRef + ExtractImageNamePart(info.ImageOnlySet.Content);
                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "High");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Medium");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Low");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);
                    break;

                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_011:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.AuthorName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.CityName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.DisplayDateName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.DisplayDateText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;

                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_012:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;

                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_013:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.AuthorName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.CityName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.DisplayDateName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.DisplayDateText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.ImageOnlySet.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    imageNameOnly = docGlobalRef + ExtractImageNamePart(info.ImageOnlySet.Content);
                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "High");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Medium");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);

                    itemChildOnly = iterDoc.CreateElement("dynamic-element");
                    itemChildOnly.SetAttribute("instance-id", "ec" + (i++));
                    itemChildOnly.SetAttribute("name", "Low");
                    itemChildOnly.SetAttribute("type", "document_library");
                    itemChildOnly.SetAttribute("index-type", "");
                    item.AppendChild(itemChildOnly);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = imageNameOnly;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    itemChildOnly.AppendChild(itemContent);
                    break;

                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_014:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.AuthorName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.AuthorText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.CityName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.CityText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.CreditText.DisplayDateName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.CreditText.DisplayDateText;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;

                case TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_015:
                    itemNum = 1;
                    foreach (var tit in info.Title) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", tit.Name + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "text");
                        rootIter.AppendChild(item);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = tit.Content;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        item.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.DocumentText.Name);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.DocumentText.Content;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    itemNum = 1;
                    foreach (var pr in info.PhotoFooterGallery.PhotoList) {
                        item = iterDoc.CreateElement("dynamic-element");
                        item.SetAttribute("instance-id", "ec" + (i++));
                        item.SetAttribute("name", pr.ImageName + itemNum);
                        item.SetAttribute("type", "text");
                        item.SetAttribute("index-type", "");
                        rootIter.AppendChild(item);

                        var imageName = docGlobalRef + ExtractImageNamePart(pr.ImageSrc);
                        var itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "High");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Medium");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);

                        itemChild = iterDoc.CreateElement("dynamic-element");
                        itemChild.SetAttribute("instance-id", "ec" + (i++));
                        itemChild.SetAttribute("name", "Low");
                        itemChild.SetAttribute("type", "document_library");
                        itemChild.SetAttribute("index-type", "");
                        item.AppendChild(itemChild);

                        itemContent = iterDoc.CreateElement("dynamic-content");
                        contentText = imageName;
                        contentText = RemoveInvalidXmlChars(contentText);
                        cdata = iterDoc.CreateCDataSection(contentText);
                        itemContent.InnerXml = cdata.OuterXml;
                        itemChild.AppendChild(itemContent);
                        itemNum++;
                    }
                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.PhotoFooterGallery.FooterTitleName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.PhotoFooterGallery.FoooterTitle;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);

                    item = iterDoc.CreateElement("dynamic-element");
                    item.SetAttribute("instance-id", "ec" + (i++));
                    item.SetAttribute("name", info.PhotoFooterGallery.FooterName);
                    item.SetAttribute("type", "text");
                    item.SetAttribute("index-type", "text");
                    rootIter.AppendChild(item);

                    itemContent = iterDoc.CreateElement("dynamic-content");
                    contentText = info.PhotoFooterGallery.Footer;
                    contentText = RemoveInvalidXmlChars(contentText);
                    cdata = iterDoc.CreateCDataSection(contentText);
                    itemContent.InnerXml = cdata.OuterXml;
                    item.AppendChild(itemContent);
                    break;
            }
            SaveXmlDocument(contentPath + @"\" + articleNum + ".xml", iterDoc);
            if (info.TemplateType == TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_001) {
            }
            else {
                if (info.TemplateType == TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_002) {
                }
            }

            if (log.IsDebugEnabled) log.Debug("CreateDocumentAttributesToXml end (Old Doc processing)");
        }
示例#6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public ExtractHTML() {
     examinedDoc = new Doc();
     page = null;
 }