/// <summary> /// Loads this <see cref="Digest"/> using the supplied <see cref="XPathNavigator"/>. /// </summary> /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</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="Digest"/> 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="Digest"/>. /// </remarks> /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception> public bool Load(XPathNavigator source, XmlNamespaceManager manager) { //------------------------------------------------------------ // Local members //------------------------------------------------------------ var wasLoaded = false; //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(source, "source"); //------------------------------------------------------------ // Attempt to extract syndication information //------------------------------------------------------------ if (source.HasChildren) { var originNavigator = source.SelectSingleNode("sync:origin", manager); if (originNavigator != null && !string.IsNullOrEmpty(originNavigator.Value)) { Origin = originNavigator.Value; wasLoaded = true; } var entriesNavigator = source.Select("sync:digestEntry", manager); var entries = new List <DigestEntry>(); foreach (XPathNavigator item in entriesNavigator) { var entry = new DigestEntry(); if (entry.Load(item, manager)) { entries.Add(entry); wasLoaded = true; } } Entries = entries.ToArray(); } return(wasLoaded); }
/// <summary> /// Loads this <see cref="Digest"/> using the supplied <see cref="XPathNavigator"/>. /// </summary> /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</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="Digest"/> 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="Digest"/>. /// </remarks> /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception> public bool Load(XPathNavigator source, XmlNamespaceManager manager) { //------------------------------------------------------------ // Local members //------------------------------------------------------------ var wasLoaded = false; //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(source, "source"); //------------------------------------------------------------ // Attempt to extract syndication information //------------------------------------------------------------ if (source.HasChildren) { var originNavigator = source.SelectSingleNode("sync:origin", manager); if (originNavigator != null && !string.IsNullOrEmpty(originNavigator.Value)) { Origin = originNavigator.Value; wasLoaded = true; } var entriesNavigator = source.Select("sync:digestEntry", manager); var entries = new List<DigestEntry>(); foreach (XPathNavigator item in entriesNavigator) { var entry = new DigestEntry(); if (entry.Load(item, manager)) { entries.Add(entry); wasLoaded = true; } } Entries = entries.ToArray(); } return wasLoaded; }