/// <summary> /// Initializes the syndication extension context using the supplied <see cref="XPathNavigator"/>. /// </summary> /// <param name="source">The <b>XPathNavigator</b> used to load this <see cref="FeedSynchronizationSyndicationExtensionContext"/>.</param> /// <param name="manager">The <see cref="XmlNamespaceManager"/> object used to resolve prefixed syndication extension elements and attributes.</param> /// <returns><b>true</b> if the <see cref="FeedSynchronizationSyndicationExtensionContext"/> was able to be initialized using the supplied <paramref name="source"/>; otherwise <b>false</b>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="source"/> 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> public bool Load(XPathNavigator source, XmlNamespaceManager manager) { bool wasLoaded = false; Guard.ArgumentNotNull(source, "source"); Guard.ArgumentNotNull(manager, "manager"); if (source.HasChildren) { XPathNavigator sharingNavigator = source.SelectSingleNode("sx:sharing", manager); XPathNavigator syncNavigator = source.SelectSingleNode("sx:sync", manager); if (sharingNavigator != null) { FeedSynchronizationSharingInformation sharing = new FeedSynchronizationSharingInformation(); if (sharing.Load(sharingNavigator)) { this.Sharing = sharing; wasLoaded = true; } } if (syncNavigator != null) { FeedSynchronizationItem synchronization = new FeedSynchronizationItem(); if (synchronization.Load(syncNavigator)) { this.Synchronization = synchronization; wasLoaded = true; } } } return(wasLoaded); }
//============================================================ // PUBLIC METHODS //============================================================ #region Load(XPathNavigator source, XmlNamespaceManager manager) /// <summary> /// Initializes the syndication extension context using the supplied <see cref="XPathNavigator"/>. /// </summary> /// <param name="source">The <b>XPathNavigator</b> used to load this <see cref="FeedSynchronizationSyndicationExtensionContext"/>.</param> /// <param name="manager">The <see cref="XmlNamespaceManager"/> object used to resolve prefixed syndication extension elements and attributes.</param> /// <returns><b>true</b> if the <see cref="FeedSynchronizationSyndicationExtensionContext"/> was able to be initialized using the supplied <paramref name="source"/>; otherwise <b>false</b>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="source"/> 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> public bool Load(XPathNavigator source, XmlNamespaceManager manager) { //------------------------------------------------------------ // Local members //------------------------------------------------------------ bool wasLoaded = false; //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(source, "source"); Guard.ArgumentNotNull(manager, "manager"); //------------------------------------------------------------ // Attempt to extract syndication extension information //------------------------------------------------------------ if (source.HasChildren) { XPathNavigator sharingNavigator = source.SelectSingleNode("sx:sharing", manager); XPathNavigator syncNavigator = source.SelectSingleNode("sx:sync", manager); if (sharingNavigator != null) { FeedSynchronizationSharingInformation sharing = new FeedSynchronizationSharingInformation(); if (sharing.Load(sharingNavigator)) { this.Sharing = sharing; wasLoaded = true; } } if (syncNavigator != null) { FeedSynchronizationItem synchronization = new FeedSynchronizationItem(); if (synchronization.Load(syncNavigator)) { this.Synchronization = synchronization; wasLoaded = true; } } } return(wasLoaded); }