protected override FeedItem ParseFeedItem(XmlNode node) { // Create a new feed item FeedItem feedItem = FeedItem.Create(); // Loop over all nodes in the feed node foreach (XmlNode childNode in node.ChildNodes) { // Handle each node that we find switch (childNode.Name.ToLower()) { case "title": feedItem.Title = System.Net.WebUtility.HtmlDecode(childNode.InnerText).Trim(); break; case "link": feedItem.Link = childNode.InnerText.Trim(); // RDF doesn't have a GUID node so we'll just use the link feedItem.Guid = feedItem.Link; break; case "description": feedItem.Description = System.Net.WebUtility.HtmlDecode(childNode.InnerText); break; } } return(feedItem); }
protected override FeedItem ParseFeedItem(XmlNode node) { // Create a new feed item FeedItem feedItem = FeedItem.Create(); // Loop over all nodes in the feed node foreach (XmlNode childNode in node.ChildNodes) { // Handle each node that we find switch (childNode.Name.ToLower()) { case "title": feedItem.Title = System.Net.WebUtility.HtmlDecode(childNode.InnerText).Trim(); break; case "link": feedItem.Link = childNode.InnerText.Trim(); break; case "guid": feedItem.Guid = childNode.InnerText.Trim(); bool permaLink = true; if (childNode.Attributes != null) { var permaLinkNode = childNode.Attributes.GetNamedItem("isPermaLink"); permaLink = (permaLinkNode == null || permaLinkNode.Value == "true"); } if (permaLink && Uri.IsWellFormedUriString(feedItem.Guid, UriKind.Absolute)) { feedItem.Link = feedItem.Guid; } break; case "description": feedItem.Description = System.Net.WebUtility.HtmlDecode(childNode.InnerText); break; } } if (string.IsNullOrWhiteSpace(feedItem.Guid)) { feedItem.Guid = feedItem.Link; } return(feedItem); }
protected override FeedItem ParseFeedItem(XmlNode node) { // Create a new feed item var feedItem = FeedItem.Create(); // Loop over all nodes in the feed node foreach (XmlNode childNode in node.ChildNodes) { // Handle each node that we find switch (childNode.Name.ToLower()) { case "title": feedItem.Title = System.Net.WebUtility.HtmlDecode(childNode.InnerText).Trim(); break; case "id": feedItem.Guid = childNode.InnerText; break; case "content": feedItem.Description = System.Net.WebUtility.HtmlDecode(childNode.InnerText); break; case "link": string rel = null; if (childNode.Attributes == null) { break; } XmlNode relNode = GetAttribute(childNode, "rel"); if (relNode != null) { rel = relNode.InnerText.Trim(); } if (string.IsNullOrEmpty(rel) || rel == "alternate") { var link = GetAttribute(childNode, "href").InnerText; if (link.StartsWith("/")) { var uri = new Uri(Feed.Link); link = uri.Scheme + "://" + uri.Host + link; } feedItem.Link = link; } break; } } if (string.IsNullOrWhiteSpace(feedItem.Guid)) { feedItem.Guid = feedItem.Link; } return(feedItem); }