Ejemplo n.º 1
0
        /// <summary>
        /// Writes the prefixed XML namespace declarations for the supplied <see cref="Collection{T}"/> collection of syndication extension <see cref="Type"/> objects to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="types">A <see cref="Collection{T}"/> collection of <see cref="Type"/> objects that represent the syndication extensions to write prefixed XML namespace declarations for.</param>
        /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="types"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        public static void WriteXmlNamespaceDeclarations(Collection <Type> types, XmlWriter writer)
        {
            Guard.ArgumentNotNull(types, "types");
            Guard.ArgumentNotNull(writer, "writer");

            foreach (Type type in types)
            {
                if (type != null)
                {
                    ISyndicationExtension extension = Activator.CreateInstance(type) as ISyndicationExtension;
                    if (extension != null)
                    {
                        extension.WriteXmlNamespaceDeclaration(writer);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Writes the prefixed XML namespace declarations for the supplied <see cref="Collection{T}"/> collection of syndication extension <see cref="Type"/> objects to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="types">A <see cref="Collection{T}"/> collection of <see cref="Type"/> objects that represent the syndication extensions to write prefixed XML namespace declarations for.</param>
        /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="types"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        public static void WriteXmlNamespaceDeclarations(Collection <Type> types, XmlWriter writer)
        {
            //------------------------------------------------------------
            //	Validate parameters
            //------------------------------------------------------------
            Guard.ArgumentNotNull(types, "types");
            Guard.ArgumentNotNull(writer, "writer");

            //------------------------------------------------------------
            //	Write each syndication extension prefixed XML namespace
            //  to the supplied writer
            //------------------------------------------------------------
            foreach (Type type in types)
            {
                if (type != null)
                {
                    ISyndicationExtension extension = Activator.CreateInstance(type) as ISyndicationExtension;
                    if (extension != null)
                    {
                        extension.WriteXmlNamespaceDeclaration(writer);
                    }
                }
            }
        }