public static void ExportOpml(string filename, IEnumerable<Feed> feeds, string name) {
            var opml = new OpmlDocument();
            opml.Head.Title = String.Format("{0} Export", name); ;

            var categories = from f in feeds
                             group f by f.Category into c
                             select new {
                                 Name = c.Key,
                                 Feeds = c.ToList()
                             };

            foreach (var category in categories) {
                var outline = new OpmlOutline(category.Name);
                outline.Attributes.Add("title", category.Name);

                foreach (var feed in category.Feeds) {
                    var let = new OpmlOutline(feed.Title);
                    let.Attributes.Add("type", "rss");
                    let.Attributes.Add("title", feed.Title);
                    let.Attributes.Add("xmlUrl", feed.Url);
                    let.Attributes.Add("htmlUrl", feed.SiteUrl);
                    outline.Outlines.Add(let);
                }

                opml.AddOutline(outline);
            }

            using (var stream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.None)) {
                opml.Save(stream);
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            OpmlOutline value = obj as OpmlOutline;

            if (value != null)
            {
                int result = String.Compare(this.ContentType, value.ContentType, StringComparison.OrdinalIgnoreCase);
                result = result | this.CreatedOn.CompareTo(value.CreatedOn);
                result = result | this.HasBreakpoint.CompareTo(value.HasBreakpoint);
                result = result | this.IsCommented.CompareTo(value.IsCommented);
                result = result | String.Compare(this.Text, value.Text, StringComparison.OrdinalIgnoreCase);

                result = result | ComparisonUtility.CompareSequence(this.Attributes, value.Attributes, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Categories, value.Categories, StringComparison.OrdinalIgnoreCase);
                result = result | OpmlOutline.CompareSequence(this.Outlines, value.Outlines);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Loads this <see cref="OpmlOutline"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="OpmlOutline"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="OpmlOutline"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            if (source.HasAttributes)
            {
                XPathNavigator attributesNavigator = source.CreateNavigator();
                if (attributesNavigator.MoveToFirstAttribute())
                {
                    if (this.LoadAttribute(attributesNavigator))
                    {
                        wasLoaded = true;
                    }
                    while (attributesNavigator.MoveToNextAttribute())
                    {
                        if (this.LoadAttribute(attributesNavigator))
                        {
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNodeIterator outlinesIterator = source.Select("outline");
                if (outlinesIterator != null && outlinesIterator.Count > 0)
                {
                    while (outlinesIterator.MoveNext())
                    {
                        OpmlOutline outline = new OpmlOutline();
                        if (outline.Load(outlinesIterator.Current, settings))
                        {
                            this.Outlines.Add(outline);
                            wasLoaded = true;
                        }
                    }
                }
            }
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
        /// <summary>
        /// Loads this <see cref="OpmlOutline"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="OpmlOutline"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="OpmlOutline"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            if (source.HasAttributes)
            {
                XPathNavigator attributesNavigator = source.CreateNavigator();
                if (attributesNavigator.MoveToFirstAttribute())
                {
                    if (this.LoadAttribute(attributesNavigator))
                    {
                        wasLoaded = true;
                    }
                    while (attributesNavigator.MoveToNextAttribute())
                    {
                        if (this.LoadAttribute(attributesNavigator))
                        {
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNodeIterator outlinesIterator = source.Select("outline");
                if (outlinesIterator != null && outlinesIterator.Count > 0)
                {
                    while (outlinesIterator.MoveNext())
                    {
                        OpmlOutline outline = new OpmlOutline();
                        if (outline.Load(outlinesIterator.Current))
                        {
                            this.Outlines.Add(outline);
                            wasLoaded = true;
                        }
                    }
                }
            }

            return(wasLoaded);
        }
示例#5
0
        //============================================================
        //    CLASS SUMMARY
        //============================================================
        /// <summary>
        /// Provides example code for the OpmlOutline class.
        /// </summary>
        public static void ClassExample()
        {
            #region OpmlOutline
            OpmlDocument document   = new OpmlDocument();

            document.Head.Title                 = "Example OPML List";
            document.Head.CreatedOn             = new DateTime(2005, 6, 18, 12, 11, 52);
            document.Head.ModifiedOn            = new DateTime(2005, 7, 2, 21, 42, 48);
            document.Head.Owner                 = new OpmlOwner("John Doe", "*****@*****.**");
            document.Head.VerticalScrollState   = 1;
            document.Head.Window                = new OpmlWindow(61, 304, 562, 842);

            // Create outline that contains child outlines
            OpmlOutline containerOutline    = new OpmlOutline("Feeds");
            containerOutline.Outlines.Add(OpmlOutline.CreateSubscriptionListOutline("Argotic", "rss", new Uri("http://www.codeplex.com/Argotic/Project/ProjectRss.aspx")));
            containerOutline.Outlines.Add(OpmlOutline.CreateSubscriptionListOutline("Google News", "feed", new Uri("http://news.google.com/?output=atom")));
            document.AddOutline(containerOutline);
            #endregion
        }
        /// <summary>
        /// Creates a new <see cref="OpmlOutline"/> that represents an inclusion outline using the supplied parameters.
        /// </summary>
        /// <param name="text">The textual content of the outline.</param>
        /// <param name="url">A <see cref="Uri"/> that represents an http address.</param>
        /// <returns>A new <see cref="OpmlOutline"/> object that represents an inclusion outline, initialized using the supplied parameters.</returns>
        /// <remarks>
        ///     <para>
        ///         When a outline is expanded in an outliner, if the <paramref name="url"/> ends with <i>.opml</i>, the outline expands in place. This is called <b>inclusion</b>.
        ///     </para>
        ///     <para>
        ///         If the <paramref name="url"/> does not end with <i>.opml</i>, the link is assumed to point to something that can be displayed in a web browser.
        ///     </para>
        ///     <para>The difference between <b>link</b> and <b>include</b> is that <i>link</i> may point to something that is displayed in a web browser, and <i>include</i> always points to an OPML file.</para>
        ///     <para>
        ///         This method will create an <see cref="OpmlOutline"/> with a <see cref="ContentType"/> of <b>include</b> if the <paramref name="url"/> ends with <i>.opml</i>,
        ///         otherwise the <see cref="ContentType"/> will have a value of <b>link</b>.
        ///     </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="url"/> is a null reference (Nothing in Visual Basic).</exception>
        public static OpmlOutline CreateInclusionOutline(string text, Uri url)
        {
            OpmlOutline outline = new OpmlOutline();

            Guard.ArgumentNotNullOrEmptyString(text, "text");
            Guard.ArgumentNotNull(url, "url");

            outline.Text = text;
            if (url.ToString().EndsWith(".opml", StringComparison.OrdinalIgnoreCase))
            {
                outline.ContentType = "include";
            }
            else
            {
                outline.ContentType = "link";
            }
            outline.Attributes.Add("url", url.ToString());

            return(outline);
        }
        /// <summary>
        /// Creates a new <see cref="OpmlOutline"/> that represents a subscription list outline using the supplied parameters.
        /// </summary>
        /// <param name="text">The textual content of the outline.</param>
        /// <param name="type">The syndication format of the feed being pointed to. Permissible values include <i>rss</i> or <i>feed</i>.</param>
        /// <param name="xmlUrl">A <see cref="Uri"/> that represents the http address of the feed.</param>
        /// <param name="htmlUrl">A <see cref="Uri"/> that represents the web site that hosts the feed. This value can be <b>null</b>.</param>
        /// <param name="version">
        ///     The version of the syndication format for the feed that's being pointed to.
        ///     Permissible values include <i>RSS</i>, <i>RSS1</i>, <i>scriptingNews</i>, or a custom version identifier for the feed.
        ///     This value can be an empty string.
        /// </param>
        /// <param name="title">The title of the feed. This value can be an empty string.</param>
        /// <param name="description">The description of the feed. This value can be an empty string.</param>
        /// <param name="language">A <see cref="CultureInfo"/> that represents the natural or formal language in which the feed is written. This value can be <b>null</b>.</param>
        /// <returns>A new <see cref="OpmlOutline"/> object that represents a subscription list outline, initialized using the supplied parameters.</returns>
        /// <remarks>
        ///     <para>
        ///         A subscription list is a possibly multiple-level list of subscriptions to feeds. Each sub-element of the body of the OPML document
        ///         is a node of type <i>rss</i> or an outline element that contains nodes of type <i>rss</i>.
        ///     </para>
        ///     <para>
        ///         Today, most subscription lists are a flat sequence of <i>rss</i> nodes, but some aggregators allow categorized subscription lists
        ///         that are arbitrarily structured. A validator may flag these files, warning that some processors may not understand and preserve the structure.
        ///     </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="type"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="type"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlUrl"/> is a null reference (Nothing in Visual Basic).</exception>
        public static OpmlOutline CreateSubscriptionListOutline(string text, string type, Uri xmlUrl, Uri htmlUrl, string version, string title, string description, CultureInfo language)
        {
            OpmlOutline outline = new OpmlOutline();

            Guard.ArgumentNotNullOrEmptyString(text, "text");
            Guard.ArgumentNotNullOrEmptyString(type, "type");
            Guard.ArgumentNotNull(xmlUrl, "xmlUrl");

            outline.Text        = text;
            outline.ContentType = type;
            outline.Attributes.Add("xmlUrl", xmlUrl.ToString());

            if (htmlUrl != null)
            {
                outline.Attributes.Add("htmlUrl", htmlUrl.ToString());
            }

            if (!String.IsNullOrEmpty(version))
            {
                outline.Attributes.Add("version", version.Trim());
            }

            if (!String.IsNullOrEmpty(title))
            {
                outline.Attributes.Add("title", title.Trim());
            }

            if (!String.IsNullOrEmpty(description))
            {
                outline.Attributes.Add("description", description.Trim());
            }

            if (language != null)
            {
                outline.Attributes.Add("language", language.Name);
            }

            return(outline);
        }
示例#8
0
        /// <summary>
        /// Adds the supplied <see cref="OpmlOutline"/> to the current instance's <see cref="Outlines"/> collection.
        /// </summary>
        /// <param name="outline">The <see cref="OpmlOutline"/> to be added.</param>
        /// <returns><b>true</b> if the <see cref="OpmlOutline"/> was added to the <see cref="Outlines"/> collection, otherwise <b>false</b>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="outline"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool AddOutline(OpmlOutline outline)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasAdded   = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(outline, "outline");

            //------------------------------------------------------------
            //	Add outline to collection
            //------------------------------------------------------------
            ((Collection<OpmlOutline>)this.Outlines).Add(outline);
            wasAdded    = true;

            return wasAdded;
        }
示例#9
0
        /// <summary>
        /// Removes the supplied <see cref="OpmlOutline"/> from the current instance's <see cref="Outlines"/> collection.
        /// </summary>
        /// <param name="outline">The <see cref="OpmlOutline"/> to be removed.</param>
        /// <returns><b>true</b> if the <see cref="OpmlOutline"/> was removed from the <see cref="Outlines"/> collection, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     If the <see cref="Outlines"/> collection of the current instance does not contain the specified <see cref="OpmlOutline"/>, will return <b>false</b>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="outline"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool RemoveOutline(OpmlOutline outline)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasRemoved = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(outline, "outline");

            //------------------------------------------------------------
            //	Remove outline from collection
            //------------------------------------------------------------
            if (((Collection<OpmlOutline>)this.Outlines).Contains(outline))
            {
                ((Collection<OpmlOutline>)this.Outlines).Remove(outline);
                wasRemoved  = true;
            }

            return wasRemoved;
        }
示例#10
0
        /// <summary>
        /// Loads this <see cref="OpmlOutline"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="OpmlOutline"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="OpmlOutline"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded              = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasAttributes)
            {
                XPathNavigator attributesNavigator = source.CreateNavigator();
                if (attributesNavigator.MoveToFirstAttribute())
                {
                    //------------------------------------------------------------
                    //	Extract first attribute
                    //------------------------------------------------------------
                    if (this.LoadAttribute(attributesNavigator))
                    {
                        wasLoaded       = true;
                    }

                    //------------------------------------------------------------
                    //	Enumerate through additional attributes
                    //------------------------------------------------------------
                    while (attributesNavigator.MoveToNextAttribute())
                    {
                        if (this.LoadAttribute(attributesNavigator))
                        {
                            wasLoaded   = true;
                        }
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNodeIterator outlinesIterator = source.Select("outline");
                if (outlinesIterator != null && outlinesIterator.Count > 0)
                {
                    while (outlinesIterator.MoveNext())
                    {
                        OpmlOutline outline = new OpmlOutline();
                        if (outline.Load(outlinesIterator.Current, settings))
                        {
                            this.Outlines.Add(outline);
                            wasLoaded   = true;
                        }
                    }
                }
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication extension information
            //------------------------------------------------------------
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);
            adapter.Fill(this);

            return wasLoaded;
        }
示例#11
0
        /// <summary>
        /// Creates a new <see cref="OpmlOutline"/> that represents a subscription list outline using the supplied parameters.
        /// </summary>
        /// <param name="text">The textual content of the outline.</param>
        /// <param name="type">The syndication format of the feed being pointed to. Permissible values include <i>rss</i> or <i>feed</i>.</param>
        /// <param name="xmlUrl">A <see cref="Uri"/> that represents the http address of the feed.</param>
        /// <param name="htmlUrl">A <see cref="Uri"/> that represents the web site that hosts the feed. This value can be <b>null</b>.</param>
        /// <param name="version">
        ///     The version of the syndication format for the feed that's being pointed to. 
        ///     Permissible values include <i>RSS</i>, <i>RSS1</i>, <i>scriptingNews</i>, or a custom version identifier for the feed. 
        ///     This value can be an empty string.
        /// </param>
        /// <param name="title">The title of the feed. This value can be an empty string.</param>
        /// <param name="description">The description of the feed. This value can be an empty string.</param>
        /// <param name="language">A <see cref="CultureInfo"/> that represents the natural or formal language in which the feed is written. This value can be <b>null</b>.</param>
        /// <returns>A new <see cref="OpmlOutline"/> object that represents a subscription list outline, initialized using the supplied parameters.</returns>
        /// <remarks>
        ///     <para>
        ///         A subscription list is a possibly multiple-level list of subscriptions to feeds. Each sub-element of the body of the OPML document 
        ///         is a node of type <i>rss</i> or an outline element that contains nodes of type <i>rss</i>.
        ///     </para>
        ///     <para>
        ///         Today, most subscription lists are a flat sequence of <i>rss</i> nodes, but some aggregators allow categorized subscription lists 
        ///         that are arbitrarily structured. A validator may flag these files, warning that some processors may not understand and preserve the structure.
        ///     </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="type"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="type"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlUrl"/> is a null reference (Nothing in Visual Basic).</exception>
        public static OpmlOutline CreateSubscriptionListOutline(string text, string type, Uri xmlUrl, Uri htmlUrl, string version, string title, string description, CultureInfo language)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            OpmlOutline outline = new OpmlOutline();

            //------------------------------------------------------------
            //	Validate parameters
            //------------------------------------------------------------
            Guard.ArgumentNotNullOrEmptyString(text, "text");
            Guard.ArgumentNotNullOrEmptyString(type, "type");
            Guard.ArgumentNotNull(xmlUrl, "xmlUrl");

            outline.Text        = text;
            outline.ContentType = type;
            outline.Attributes.Add("xmlUrl", xmlUrl.ToString());

            if (htmlUrl != null)
            {
                outline.Attributes.Add("htmlUrl", htmlUrl.ToString());
            }

            if (!String.IsNullOrEmpty(version))
            {
                outline.Attributes.Add("version", version.Trim());
            }

            if (!String.IsNullOrEmpty(title))
            {
                outline.Attributes.Add("title", title.Trim());
            }

            if (!String.IsNullOrEmpty(description))
            {
                outline.Attributes.Add("description", description.Trim());
            }

            if (language != null)
            {
                outline.Attributes.Add("language", language.Name);
            }

            return outline;
        }
示例#12
0
        /// <summary>
        /// Creates a new <see cref="OpmlOutline"/> that represents an inclusion outline using the supplied parameters.
        /// </summary>
        /// <param name="text">The textual content of the outline.</param>
        /// <param name="url">A <see cref="Uri"/> that represents an http address.</param>
        /// <returns>A new <see cref="OpmlOutline"/> object that represents an inclusion outline, initialized using the supplied parameters.</returns>
        /// <remarks>
        ///     <para>
        ///         When a outline is expanded in an outliner, if the <paramref name="url"/> ends with <i>.opml</i>, the outline expands in place. This is called <b>inclusion</b>. 
        ///     </para>
        ///     <para>
        ///         If the <paramref name="url"/> does not end with <i>.opml</i>, the link is assumed to point to something that can be displayed in a web browser.
        ///     </para>
        ///     <para>The difference between <b>link</b> and <b>include</b> is that <i>link</i> may point to something that is displayed in a web browser, and <i>include</i> always points to an OPML file.</para>
        ///     <para>
        ///         This method will create an <see cref="OpmlOutline"/> with a <see cref="ContentType"/> of <b>include</b> if the <paramref name="url"/> ends with <i>.opml</i>, 
        ///         otherwise the <see cref="ContentType"/> will have a value of <b>link</b>.
        ///     </para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="text"/> is an empty string.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="url"/> is a null reference (Nothing in Visual Basic).</exception>
        public static OpmlOutline CreateInclusionOutline(string text, Uri url)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            OpmlOutline outline = new OpmlOutline();

            //------------------------------------------------------------
            //	Validate parameters
            //------------------------------------------------------------
            Guard.ArgumentNotNullOrEmptyString(text, "text");
            Guard.ArgumentNotNull(url, "url");

            outline.Text            = text;
            if (url.ToString().EndsWith(".opml", StringComparison.OrdinalIgnoreCase))
            {
                outline.ContentType = "include";
            }
            else
            {
                outline.ContentType = "link";
            }
            outline.Attributes.Add("url", url.ToString());

            return outline;
        }
 /// <summary>
 /// Creates a new <see cref="OpmlOutline"/> that represents a subscription list outline using the supplied parameters.
 /// </summary>
 /// <param name="text">The textual content of the outline.</param>
 /// <param name="type">The syndication format of the feed being pointed to. Permissible values include <i>rss</i> or <i>feed</i>.</param>
 /// <param name="xmlUrl">A <see cref="Uri"/> that represents the http address of the feed.</param>
 /// <returns>A new <see cref="OpmlOutline"/> object that represents a subscription list outline, initialized using the supplied parameters.</returns>
 /// <remarks>
 ///     <para>
 ///         A subscription list is a possibly multiple-level list of subscriptions to feeds. Each sub-element of the body of the OPML document
 ///         is a node of type <i>rss</i> or an outline element that contains nodes of type <i>rss</i>.
 ///     </para>
 ///     <para>
 ///         Today, most subscription lists are a flat sequence of <i>rss</i> nodes, but some aggregators allow categorized subscription lists
 ///         that are arbitrarily structured. A validator may flag these files, warning that some processors may not understand and preserve the structure.
 ///     </para>
 /// </remarks>
 /// <exception cref="ArgumentNullException">The <paramref name="text"/> is a null reference (Nothing in Visual Basic).</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="text"/> is an empty string.</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="type"/> is a null reference (Nothing in Visual Basic).</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="type"/> is an empty string.</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="xmlUrl"/> is a null reference (Nothing in Visual Basic).</exception>
 public static OpmlOutline CreateSubscriptionListOutline(string text, string type, Uri xmlUrl)
 {
     return(OpmlOutline.CreateSubscriptionListOutline(text, type, xmlUrl, null, String.Empty, String.Empty, String.Empty, null));
 }
        /// <summary>
        /// Modifies the <see cref="OpmlDocument"/> to match the data source.
        /// </summary>
        /// <param name="resource">The <see cref="OpmlDocument"/> to be filled.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="resource"/> is a null reference (Nothing in Visual Basic).</exception>
        public void Fill(OpmlDocument resource)
        {
            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(resource, "resource");

            //------------------------------------------------------------
            //	Create namespace resolver
            //------------------------------------------------------------
            XmlNamespaceManager manager     = new XmlNamespaceManager(this.Navigator.NameTable);

            //------------------------------------------------------------
            //	Attempt to fill syndication resource
            //------------------------------------------------------------
            XPathNavigator documentNavigator    = this.Navigator.SelectSingleNode("opml", manager);
            if (documentNavigator != null)
            {
                XPathNavigator headNavigator    = documentNavigator.SelectSingleNode("head", manager);
                if (headNavigator != null)
                {
                    resource.Head.Load(headNavigator, this.Settings);
                }

                XPathNodeIterator outlineIterator   = documentNavigator.Select("body/outline", manager);
                if (outlineIterator != null && outlineIterator.Count > 0)
                {
                    int counter = 0;
                    while (outlineIterator.MoveNext())
                    {
                        OpmlOutline outline = new OpmlOutline();
                        counter++;

                        if (outline.Load(outlineIterator.Current, this.Settings))
                        {
                            if (this.Settings.RetrievalLimit != 0 && counter > this.Settings.RetrievalLimit)
                            {
                                break;
                            }

                            ((Collection<OpmlOutline>)resource.Outlines).Add(outline);
                        }
                    }
                }

                SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(documentNavigator, this.Settings);
                adapter.Fill(resource, manager);
            }
        }