Ejemplo n.º 1
0
        public XNode ToXML()
        {
            XElement xBody = new XElement(Fb2Const.fb2DefaultNamespace + Fb2BodyItemName);

            if (!string.IsNullOrEmpty(Name))
            {
                xBody.Add(new XAttribute(Fb2NameAttributeName, Name));
            }
            if (!string.IsNullOrEmpty(Lang))
            {
                xBody.Add(new XAttribute(XNamespace.Xml + "lang", Lang));
            }
            if (ImageName != null)
            {
                xBody.Add(ImageName.ToXML());
            }
            if (Title != null)
            {
                xBody.Add(Title.ToXML());
            }
            foreach (EpigraphItem EpItem in epigraphs)
            {
                xBody.Add(EpItem.ToXML());
            }
            foreach (SectionItem SecItem in sections)
            {
                xBody.Add(SecItem.ToXML());
            }

            return(xBody);
        }
Ejemplo n.º 2
0
        public XNode ToXML()
        {
            XElement xSection = new XElement(Fb2Const.fb2DefaultNamespace + Fb2TextSectionElementName);

            if (!string.IsNullOrEmpty(ID))
            {
                xSection.Add(new XAttribute("id", ID));
            }
            if (!string.IsNullOrEmpty(Lang))
            {
                xSection.Add(new XAttribute(XNamespace.Xml + "lang", Lang));
            }

            if (Title != null)
            {
                xSection.Add(Title.ToXML());
            }
            foreach (EpigraphItem EpItem in epigraphs)
            {
                xSection.Add(EpItem.ToXML());
            }
            if (SectionImages.Count != 0)
            {
                //xSection.Add(SectionImages.ToXML());
                foreach (var image in SectionImages)
                {
                    xSection.Add(image.ToXML());
                }
            }
            if (Annotation != null)
            {
                xSection.Add(Annotation.ToXML());
            }
            foreach (IFb2TextItem ContItem in content)
            {
                xSection.Add(ContItem.ToXML());
            }

            return(xSection);
        }