/// <summary> /// Initializes the supplied <see cref="RssChannel"/> using the specified <see cref="XPathNavigator"/> and <see cref="XmlNamespaceManager"/>. /// </summary> /// <param name="channel">The <see cref="RssChannel"/> to be filled.</param> /// <param name="navigator">The <see cref="XPathNavigator"/> used to navigate the channel XML data.</param> /// <param name="manager">The <see cref="XmlNamespaceManager"/> used to resolve XML namespace prefixes.</param> /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> object used to configure the load operation.</param> /// <exception cref="ArgumentNullException">The <paramref name="channel"/> is a null reference (Nothing in Visual Basic).</exception> /// <exception cref="ArgumentNullException">The <paramref name="navigator"/> is a null reference (Nothing in Visual Basic).</exception> /// <exception cref="ArgumentNullException">The <paramref name="manager"/> 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> private static void FillChannel(RssChannel channel, XPathNavigator navigator, XmlNamespaceManager manager, SyndicationResourceLoadSettings settings) { Guard.ArgumentNotNull(channel, "channel"); Guard.ArgumentNotNull(navigator, "navigator"); Guard.ArgumentNotNull(manager, "manager"); Guard.ArgumentNotNull(settings, "settings"); XPathNavigator descriptionNavigator = navigator.SelectSingleNode("description", manager); XPathNavigator linkNavigator = navigator.SelectSingleNode("link", manager); XPathNavigator titleNavigator = navigator.SelectSingleNode("title", manager); XPathNavigator languageNavigator = navigator.SelectSingleNode("language", manager); if (descriptionNavigator != null && !String.IsNullOrEmpty(descriptionNavigator.Value)) { channel.Description = descriptionNavigator.Value; } if (linkNavigator != null) { Uri link; if (Uri.TryCreate(linkNavigator.Value, UriKind.RelativeOrAbsolute, out link)) { channel.Link = link; } } if (titleNavigator != null && !String.IsNullOrEmpty(titleNavigator.Value)) { channel.Title = titleNavigator.Value; } if (languageNavigator != null && !String.IsNullOrEmpty(languageNavigator.Value)) { try { CultureInfo language = new CultureInfo(languageNavigator.Value); channel.Language = language; } catch (ArgumentException) { System.Diagnostics.Trace.TraceWarning("Rss092SyndicationResourceAdapter unable to determine CultureInfo with a name of {0}.", languageNavigator.Value); } } XPathNavigator imageNavigator = navigator.SelectSingleNode("image", manager); if (imageNavigator != null) { channel.Image = new RssImage(); Rss092SyndicationResourceAdapter.FillImage(channel.Image, imageNavigator, manager, settings); } Rss092SyndicationResourceAdapter.FillChannelOptionals(channel, navigator, manager, settings); Rss092SyndicationResourceAdapter.FillChannelCollections(channel, navigator, manager, settings); SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(navigator, settings); adapter.Fill(channel); }