Beispiel #1
0
        /// <summary>
        /// Serializes the object to XML according to RSS 0.91.
        /// </summary>
        /// <param name="xdRss"></param>
        /// <returns></returns>
        private XmlNode SerializeToXml_1_0(XmlDocument xdRdf, RdfChannelItems channelItems, string prefix, RdfChannelImage channelImage, RdfChannelTextInput channelTextInput)
        {
            XmlAttribute xaAbout = xdRdf.CreateAttribute(prefix, RDF_ATTRIBUTE_ABOUT, xdRdf.DocumentElement.NamespaceURI);

            xaAbout.InnerText = this.GetAbout();

            XmlElement xeChannel = xdRdf.CreateElement(null, RDF_ELEMENT_CHANNEL, xdRdf.DocumentElement.Attributes[RDF_ATTRIBUTE_XMLNS].InnerText);

            xeChannel.Attributes.Append(xaAbout);

            if (this.Title != null)
            {
                xeChannel.AppendChild(SerializeTitleToXml(xdRdf));
            }
            if (this.Link != null)
            {
                xeChannel.AppendChild(SerializeLinkToXml(xdRdf));
            }
            if (this.Description != null)
            {
                xeChannel.AppendChild(SerializeDescriptionToXml(xdRdf));
            }
            if (this.Image != null)
            {
                xeChannel.AppendChild(this.Image.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            else if (channelImage != null)
            {
                xeChannel.AppendChild(channelImage.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            if (this.Items != null)
            {
                xeChannel.AppendChild(this.Items.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            else if (channelItems != null)
            {
                xeChannel.AppendChild(channelItems.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            if (this.TextInput != null)
            {
                xeChannel.AppendChild(this.TextInput.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            else if (channelTextInput != null)
            {
                xeChannel.AppendChild(channelTextInput.SerializeToXml(xdRdf, RdfVersion.RDF_1_0, prefix));
            }
            //
            // Always serialize modules last.
            //
            if (this.Modules != null)
            {
                this.Modules.SerializeToXml(xeChannel);
            }
            return(xeChannel);
        }