static Item HandleAtomLink(Item item, XElement link) { string rel = link.Attribute(XNames.Atom.Rel)?.Value ?? "alternate"; string type = link.Attribute(XNames.Atom.Type)?.Value ?? "text/html"; string href = link.Attribute(XNames.Atom.Href)?.Value; if (String.Equals(rel, "alternate", StringComparison.OrdinalIgnoreCase) && type.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) { item = item.With(link: SyndicationUtil.ParseLink(href, link)); } if (String.Equals(rel, "self", StringComparison.OrdinalIgnoreCase) && type.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) { item = item.With(permaLink: SyndicationUtil.ParseLink(href, link)); } if (link.Attribute(XNames.Atom.Rel)?.Value == "enclosure") { item = item.With(enclosures: item.Enclosures.Add(new Enclosure( length: link.Attribute(XNames.Atom.Length)?.Value, type: type, url: SyndicationUtil.ParseLink(href, link) ))); } return(item); }
static Item HandleEnclosure(Item item, XElement element) { return(item.With(enclosures: item.Enclosures.Add(new Enclosure( length: element.Attribute(XNames.RSS.Length)?.Value, type: element.Attribute(XNames.RSS.Type)?.Value, url: SyndicationUtil.ParseLink(element.Attribute(XNames.RSS.Url)?.Value, element) )))); }
static Item HandleGuid(Item item, XElement element) { item = item.With(id: element.Value); if (item.Id.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || item.Id.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { item = item.With(permaLink: SyndicationUtil.ParseLink(item.Id, element)); } return(item); }