public FilterAction Apply(SyndicationItem item) { bool result; TextSyndicationContent content = item.Content as TextSyndicationContent; TextSyndicationContent summary = item.Summary; switch (Field) { case FeedField.Any: result = IsMatch(item.Title.Text) || (summary != null && IsMatch(summary.Text)) || (content != null && IsMatch(content.Text)); break; case FeedField.Title: result = IsMatch(item.Title.Text); break; case FeedField.Description: result = (summary != null && IsMatch(summary.Text)) || (content != null && IsMatch(content.Text)); break; default: throw new NotImplementedException(); } return(result ? this.Action : FilterAction.None); }
private string getFirstPicture(SyndicationItem item) { TextSyndicationContent tsc = (TextSyndicationContent)item.Content; string itemContent = tsc.Text; var doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(itemContent); var nodes = doc.DocumentNode.SelectNodes("//img"); var imageNode = doc.DocumentNode.SelectSingleNode("//img"); if (imageNode == null) { return("/Content/Images/Home/Services/Small/Nutrition2.jpg"); } else { return(imageNode.GetAttributeValue("src", "/Content/Images/Home/Services/Small/Nutrition2.jpg")); } // return //throw new NotImplementedException(); }
private List <SyndicationItem> CreateFeedItems() { string departmentFis = Request.QueryString["DepartmentFIS"]; string schoolCode = Request.QueryString["SchoolCode"]; var positions = PositionBLL.GetByStatusAndDepartment(false, true, true, departmentFis, schoolCode).Take(MaxItemsInFeed); List <SyndicationItem> feedItems = new List <SyndicationItem>(); foreach (var position in positions) { var positionUrl = new Uri(GetFullyQualifiedUrl("/PositionDetails.aspx") + "?PositionID=" + position.ID.ToString()); SyndicationItem item = new SyndicationItem(); item.Title = TextSyndicationContent.CreatePlaintextContent(position.PositionTitle); item.Links.Add(SyndicationLink.CreateAlternateLink(positionUrl)); item.Summary = TextSyndicationContent.CreatePlaintextContent(position.ShortDescription); item.PublishDate = position.DatePosted; feedItems.Add(item); } return(feedItems); }
private void fillEntry(SyndicationItem itemToDisplay) { string header = Strings.RssHeaderNews; if (itemToDisplay.Links.Count > 0) { hlRssTitle.Tag = itemToDisplay.Links[0]; hlRssTitle.IsHitTestVisible = true; } else { hlRssTitle.IsHitTestVisible = false; } string title = itemToDisplay.Title.Text; TextSyndicationContent content = itemToDisplay.Summary ?? itemToDisplay.Content as TextSyndicationContent; if (content != null) { MakeFormattedTextBlock(lblRssDescription, content.Text); } if (itemToDisplay.Categories.Count > 0 && itemToDisplay.Categories[0].Name != "BA") { header = Strings.RssHeaderTips; title = string.Format(Strings.usrRssReader_TipTitle, currentIndex + 1, feeds.Count, title); } hlRssTitle.Content = title; var toolsPane = MainWindow.Instance.GetAnchorable("RssReader"); if (toolsPane != null) { toolsPane.Title = header; } }
public void Advanced() { // Defaults to Plaintext TextSyndicationContent stext = new TextSyndicationContent(lorem); Assert.AreEqual(text_types [(int)TextSyndicationContentKind.Plaintext], stext.Type, "#A1"); }
private static List <SyndicationItem> GetPosts(string pbaseUrl, SortedDictionary <string, dynamic> pPostMetaData) { var items = new List <SyndicationItem>(); foreach (var post in pPostMetaData) { var item = new SyndicationItem(); var title = post.Value.title; var url = pbaseUrl + post.Value.link.url; var content = "<p>" + post.Value.summary + "</p>" + FirstAppeared(url, title); item.Title = TextSyndicationContent.CreatePlaintextContent(title); item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(url))); item.Summary = new CDataSyndicationContent(new TextSyndicationContent(content, TextSyndicationContentKind.Html)); //item.Summary = TextSyndicationContent.CreatePlaintextContent(post.Value.summary); //item.Summary = TextSyndicationContent.CreateHtmlContent("<![CDATA[" + "<p>" + post.Value.summary + "</p>" + FirstAppeared(url, title) + "]]>"); var date = DateTime.Parse(post.Value.publish_date); item.PublishDate = new DateTimeOffset(date); item.Authors.Add(new SyndicationPerson(post.Value.author.email, post.Value.author.name, post.Value.author.url)); // the parameters are the wrong way around! items.Add(item); } return(items); }
protected override void WriteFile(HttpResponseBase response) { var items = new List <SyndicationItem>(); foreach (var item in this.Items) { string contentString = String.Format("{0} - {1}", item.Artist, item.Title); var rssItem = new SyndicationItem(); TextSyndicationContent titleContent = new TextSyndicationContent(contentString); rssItem.Title = titleContent; rssItem.Content = titleContent; rssItem.Id = "http://" + item.Url; rssItem.LastUpdatedTime = item.ReleaseDate; rssItem.PublishDate = item.ReleaseDate; rssItem.Summary = new TextSyndicationContent(contentString, TextSyndicationContentKind.Plaintext); items.Add(rssItem); } SyndicationFeed feed = new SyndicationFeed( this.Title, this.Title, currentUrl, items ); Rss20FeedFormatter formatter = new Rss20FeedFormatter(feed); using (XmlWriter writer = XmlWriter.Create(response.Output)) { formatter.WriteTo(writer); } }
public SyndicationFeed GetRssViewModel() { var items = new List <SyndicationItem>(); var products = from p in Database.Products select new { p.Id, p.Name, p.QuantityPerUnit, p.UnitPrice, CategoryName = p.Category.Name, CategoryId = p.CategoryID } ; foreach (var p in products) { var contentString = string.Format("Quantity per unit: {0} - Unit Price: {1:0.00}", p.QuantityPerUnit, p.UnitPrice); var content = new TextSyndicationContent(contentString); var item = new SyndicationItem(); item.Categories.Add(new SyndicationCategory(p.CategoryName)); item.Title = new TextSyndicationContent(p.Name, TextSyndicationContentKind.Plaintext); item.BaseUri = new Uri(UrlBuilder.BuildProductPageUrl(p.Id, p.Name), UriKind.Relative); item.LastUpdatedTime = DateTime.Now; item.Summary = content; item.Content = content; items.Add(item); } var feed = new SyndicationFeed(items); feed.Title = new TextSyndicationContent("NSK Online Store product catalog"); feed.LastUpdatedTime = DateTime.Now; return(feed); }
private void createVideoSyndicationFeed() { //Create syndicated feed var myFeed = new SyndicationFeed(); myFeed.Title = TextSyndicationContent.CreatePlaintextContent(user.CompanyName); myFeed.Description = TextSyndicationContent.CreatePlaintextContent("Video Podcast RSS FEED"); myFeed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri("https://versolstore.blob.core.windows.net/" + user.CompanyName.ToLower() + "devstoreaccount1/videos/rss.xml"))); myFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri("https://versolstore.blob.core.windows.net/" + user.CompanyName.ToLower() + "devstoreaccount1/videos/rss.xml"))); myFeed.Copyright = TextSyndicationContent.CreatePlaintextContent("All rights reserved"); myFeed.Language = "en-us"; //Return the feed's xml content as the response MemoryStream ms = new MemoryStream(); XmlWriter feedWriter = XmlWriter.Create(ms); Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(myFeed); rssFormatter.WriteTo(feedWriter); feedWriter.Close(); var container = client.GetContainerReference(user.CompanyName.ToLower()); var blob = container.GetBlockBlobReference("videos/video.rss"); blob.UploadFromByteArray(ms.ToArray(), 0, ms.ToArray().Length); ms.Close(); }
/// <summary> /// Converts This IComposableMessage Into A Geo-RSS SyndicationItem /// </summary> /// <param name="myitem">Pointer to a Syndication Item to Populate</param> internal override void ToGeoRSS(System.ServiceModel.Syndication.SyndicationItem myitem) { myitem.Title = new TextSyndicationContent("Field Observation - " + this.observationType.ToString() + " (EDXL-SitRep)"); TextSyndicationContent content = new TextSyndicationContent("Observation: " + this.observationText + "\nImmediate Needs: " + this.immediateNeeds); myitem.Content = content; }
protected virtual void AddHtmlToContent(SyndicationItem syndicationItem, Dictionary <string, string> getHtml) { if (!(syndicationItem.Content is TextSyndicationContent)) { return; } foreach (KeyValuePair <string, string> pair in getHtml) { string value = pair.Value; if (pair.Key == "categories" || pair.Key == "tags") { value = pair.Value; } syndicationItem.ElementExtensions.Add(new XElement(pair.Key, new XCData(value)).CreateReader()); } TextSyndicationContent content = syndicationItem.Content as TextSyndicationContent; string contentText = content.Text; if (!String.IsNullOrEmpty(contentText)) { contentText = content.Text; } syndicationItem.Content = new TextSyndicationContent(contentText, TextSyndicationContentKind.Html); }
public void CreateRssFeed() { SyndicationFeed feed = new SyndicationFeed("Hyston blog", "Mumblings about programblings", new Uri("https://hyston.blog/rss"), "hyston.blog", DateTime.Now); SyndicationPerson sp = new SyndicationPerson("[email protected] (Ilja Stepanow)", "Ilja Stepanow", "https://hyston.blog"); feed.Authors.Add(sp); var allPosts = blogPostRepository.RetrieveAll(); List <SyndicationItem> items = new List <SyndicationItem>(); foreach (var post in allPosts) { try { TextSyndicationContent textContent = new TextSyndicationContent(post.HtmlContent); SyndicationItem item = new SyndicationItem(post.Title, textContent, new Uri($"https://hyston.blog/{post.FileName}"), post.FileName, post.Created); items.Add(item); } catch (System.Exception) { logger.LogError($"Failed to add post {post.FileName} into rss"); } } feed.Items = items; feed.Language = "en-us"; feed.LastUpdatedTime = DateTime.Now; var rssPath = String.Join('/', configuration["PostsLocalPath"], configuration["RssFeedFile"]); XmlWriter rssWriter = XmlWriter.Create(rssPath); Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed); rssFormatter.WriteTo(rssWriter); rssWriter.Close(); }
private static void FillRSSData(List <Article> dataList, string url, CategoryEnums cat) { try { XmlReader reader = XmlReader.Create(url); SyndicationFeed feed = SyndicationFeed.Load(reader); reader.Close(); foreach (SyndicationItem item in feed.Items) { Article d = new Article(); d.Oid = Guid.NewGuid(); d.Header = item.Title.Text; d.Content = item.Summary.Text; d.PublishedDate = item.PublishDate.DateTime; d.Url = item.Id; d.Generator = feed.Title.Text; d.Category = cat; dataList.Add(d); string link = MakeLink(d.Content); if (!string.IsNullOrEmpty(link) && (link.EndsWith(".png") || link.EndsWith(".jpg") || link.EndsWith(".jpeg"))) { d.Photo = link; } if (string.IsNullOrEmpty(d.Photo)) { foreach (SyndicationElementExtension extension in item.ElementExtensions) { XElement ele = extension.GetObject <XElement>(); if (!string.IsNullOrEmpty(ele.ToString())) { link = MakeLink(ele.ToString()); if (!string.IsNullOrEmpty(link) && (link.EndsWith(".png") || link.EndsWith(".jpg") || link.EndsWith(".jpeg"))) { d.Photo = link; break; } } } } if (item.Content != null) { TextSyndicationContent tsc = (TextSyndicationContent)item.Content; if (!string.IsNullOrEmpty(tsc.Text) && string.IsNullOrEmpty(d.Photo)) { link = MakeLink(tsc.Text); d.Photo = link; } } } } catch (Exception ex) { Console.WriteLine("Error URL---->" + url); } }
public static void CreateSampleFeed() { var feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now); // Add a custom attribute. var xqName = new XmlQualifiedName("CustomAttribute"); feed.AttributeExtensions.Add(xqName, "Value"); var sp = new SyndicationPerson("*****@*****.**", "Jesper Aaberg", "http://Jesper/Aaberg"); feed.Authors.Add(sp); var category = new SyndicationCategory("FeedCategory", "CategoryScheme", "CategoryLabel"); feed.Categories.Add(category); feed.Contributors.Add(new SyndicationPerson("*****@*****.**", "Lene Aaling", "http://lene/aaling")); feed.Copyright = new TextSyndicationContent("Copyright 2007"); feed.Description = new TextSyndicationContent("This is a sample feed"); // Add a custom element. var doc = new XmlDocument(); var feedElement = doc.CreateElement("CustomElement"); feedElement.InnerText = "Some text"; feed.ElementExtensions.Add(feedElement); feed.Generator = "Sample Code"; feed.Id = "FeedID"; feed.ImageUrl = new Uri("http://server/image.jpg"); var textContent = new TextSyndicationContent("Some text content"); var item = new SyndicationItem("Item Title", textContent, new Uri("http://server/items"), "ItemID", DateTime.Now); var items = new List <SyndicationItem>(); items.Add(item); feed.Items = items; feed.Language = "en-us"; feed.LastUpdatedTime = DateTime.Now; var link = new SyndicationLink(new Uri("http://server/link"), "alternate", "Link Title", "text/html", 1000); feed.Links.Add(link); var atomWriter = XmlWriter.Create("atom.xml"); var atomFormatter = new Atom10FeedFormatter(feed); atomFormatter.WriteTo(atomWriter); atomWriter.Close(); var rssWriter = XmlWriter.Create("rss.xml"); var rssFormatter = new Rss20FeedFormatter(feed); rssFormatter.WriteTo(rssWriter); rssWriter.Close(); }
public void Ctor_String_TextSyndicationContentKind(string text, TextSyndicationContentKind textKind, string type) { var content = new TextSyndicationContent(text, textKind); Assert.Empty(content.AttributeExtensions); Assert.Equal(text, content.Text); Assert.Equal(type, content.Type); }
public static void Snippet3() { // <Snippet3> TextSyndicationContent content = new TextSyndicationContent("This is some text content"); Uri altLink = new Uri("http://someserver/item"); SyndicationItem item = new SyndicationItem("Item Title", content, altLink, "Item ID", DateTime.Now); // </Snippet3> }
public static void Snippet35() { // <Snippet35> TextSyndicationContent content = new TextSyndicationContent("Item Content"); Uri uri = new Uri("http://Item/Alternate/Link"); SyndicationItem item = new SyndicationItem("Item Title", content, uri, "itemID", DateTimeOffset.Now); // </Snippet35> }
public void CreateXhtmlContent_Invoke_ReturnsExpected(string content) { TextSyndicationContent syndicationContent = SyndicationContent.CreateXhtmlContent(content); Assert.Empty(syndicationContent.AttributeExtensions); Assert.Equal(content, syndicationContent.Text); Assert.Equal("xhtml", syndicationContent.Type); }
public void Ctor_String(string text) { var content = new TextSyndicationContent(text); Assert.Empty(content.AttributeExtensions); Assert.Equal(text, content.Text); Assert.Equal("text", content.Type); }
/// <summary> /// Converts This IComposableMessage Into A Geo-RSS SyndicationItem /// </summary> /// <param name="myitem">Pointer to a Syndication Item to Populate</param> internal override void ToGeoRSS(System.ServiceModel.Syndication.SyndicationItem myitem) { // myitem.Title = new TextSyndicationContent("Field Observation - " + observationType.ToString() + " (EDXL-SitRep)"); // TextSyndicationContent content = new TextSyndicationContent("Observation: " + this.observationText + "\nImmediate Needs: " + this.immediateNeeds); myitem.Title = new TextSyndicationContent("Casualty and Illness Summary By Period - " + " (EDXL-SitRep)"); TextSyndicationContent content = new TextSyndicationContent("CasualtyandIllnessSummaryByPeriod: " + "\nImmediate Needs: "); myitem.Content = content; }
public void Ctor_TextSyndicationContent_Empty() { var original = new TextSyndicationContent("content"); var clone = new TextSyndicationContentSubclass(original); Assert.Empty(clone.AttributeExtensions); Assert.Equal("content", clone.Text); Assert.Equal("text", clone.Type); }
private static JsonObject[] GetTitleExtensions(TextSyndicationContent title) { List <JsonObject> extensions = new List <JsonObject>(); extensions.Add(ReaderUtils.CreateExtension("type", null, title.Type)); extensions.AddRange(title.AttributeExtensions.Select(pair => ReadExtension(pair))); return(extensions.ToArray()); }
public void Clone_Empty_ReturnsExpected() { var original = new TextSyndicationContent("content"); TextSyndicationContent clone = Assert.IsType <TextSyndicationContent>(original.Clone()); Assert.Empty(clone.AttributeExtensions); Assert.Equal("content", clone.Text); Assert.Equal("text", clone.Type); }
public void HtmlSimple() { TextSyndicationContent shtml = new TextSyndicationContent(validhtml, TextSyndicationContentKind.Html); Assert.AreEqual(typeof(TextSyndicationContent), shtml.GetType(), "#HS1"); Assert.AreEqual(typeof(string), shtml.Text.GetType(), "#HS2"); // check for content and type Assert.AreEqual(validhtml, shtml.Text.ToString(), "#HS3"); Assert.AreEqual(text_types [(int)TextSyndicationContentKind.Html], shtml.Type, "#HS4"); }
public void Ctor_TextSyndicationContent_Collections(TextSyndicationContent title, ResourceCollectionInfo[] collections) { var workspace = new Workspace(title, collections); Assert.Empty(workspace.AttributeExtensions); Assert.Null(workspace.BaseUri); Assert.Equal(collections ?? new ResourceCollectionInfo[0], workspace.Collections); Assert.Empty(workspace.ElementExtensions); Assert.Equal(title, workspace.Title); }
public static void Snippet1() { // <Snippet1> TextSyndicationContent textContent = new TextSyndicationContent("Some text content"); // </Snippet1> // <Snippet2> TextSyndicationContent textContent2 = new TextSyndicationContent("Some text content", TextSyndicationContentKind.Plaintext); // </Snippet2> }
public List <ImagePostData> Load() { SyndicationFeed feed; try { feed = SyndicationFeed.Load(XmlReader.Create(URI)); } catch (Exception e) { Console.WriteLine("Exception Thrown: " + e.Message); return(null); } List <ImagePostData> returnList = new List <ImagePostData>(); foreach (var item in feed.Items) { string imgUrl = ""; TextSyndicationContent tsc = (TextSyndicationContent)item.Content; var match = Regex.Match(tsc.Text, "a href=\"https://cdn.awwni.me/(?<1>.*?)\"", RegexOptions.ExplicitCapture); if (match.Success && match.Groups[1].Value != "") { imgUrl = "https://cdn.awwni.me/" + match.Groups[1].Value; } else { match = Regex.Match(tsc.Text, "a href=\"https://i.redd.it/(?<1>.*?)\"", RegexOptions.ExplicitCapture); if (match.Success && match.Groups[1].Value != "") { imgUrl = "https://i.redd.it/" + match.Groups[1].Value; } else { continue; } } //Console.WriteLine("{2}:{0}:{1}", item.Title.Text, imgUrl, item.Id); if (!log.CheckKey(item.Id)) { Console.WriteLine("{2}:{0}:{1}", item.Title.Text, imgUrl, item.Id); returnList.Add(new ImagePostData() { Title = item.Title.Text, URL = imgUrl, Author = item.Authors[0].Name }); log.Log(item.Id, DateTime.Now); } } return(returnList); }
public static String GetText(this TextSyndicationContent content) { switch (content.Type.ToLower()) { case "text": return(content.Text); default: throw new Exception(content.Type); } }
private string GenerateText(string html, string url, SyndicationItem item) { string text = "<p>Fala meu povo Mixturados, mais uma notícia adicionada para vocês!</p>"; string[] aux; switch (url) { case "LolNews": aux = html.Split(new string[] { "<div class=\"entry-content\">" }, StringSplitOptions.None); aux = aux[1].Split(new string[] { "<div style=\" width: 100%;" }, StringSplitOptions.None); text += aux[0]; break; case "Gamelogia": aux = html.Split(new string[] { "<div class=\"post-meta\">" }, StringSplitOptions.None); aux = aux[1].Split(new string[] { "<div class=\"sharedaddy sd-sharing-enabled\">" }, StringSplitOptions.None); text += aux[0]; break; case "Hearth PWN": text += item.Summary.Text; break; case "NerfPlz": TextSyndicationContent tsc = (TextSyndicationContent)item.Content; text += tsc.Text; break; case "Heroes Nexus": //img = links[3]; break; case "MyCNB": aux = html.Split(new string[] { "<div class=\"intro-artigo\">" }, StringSplitOptions.None); aux = aux[1].Split(new string[] { "<a target='_blank' href='index.php?option=com_banners&task=click&id=27' >" }, StringSplitOptions.None); text += aux[0]; aux = text.Split(new string[] { "<img src=\"/" }, StringSplitOptions.None); if (aux.Length > 1) { text = aux[0] + "<img src=\"http://mycnb.uol.com.br/" + aux[1]; } break; case "Tecmundo": aux = html.Split(new string[] { "<div class=\"article-text highlight\" itemprop=articleBody><div class=\"uk-hidden-small nzn-ads-rectangle\" id=ads-square><script type=text/javascript>googletag.cmd.push(function(){googletag.display('ads-square');});</script></div>" }, StringSplitOptions.None); aux = aux[1].Split(new string[] { "<p class=nzn-rexposta-intervention>" }, StringSplitOptions.None); text += aux[0]; break; } return(text); }
private SyndicationItem GetActiveSyndication(Tender tender) { string id = "" + tender.Id; var title = tender.TenderDescription; string data = tender.ToString(); data += "\n\nTo see more details wisit our site.\n#Medbay-Tech Hospital#\n"; TextSyndicationContent textContent = new TextSyndicationContent(data); return(new SyndicationItem(title, textContent, new Uri(GetPharmacyDomain() + "/dean/activeTender"), id, tender.EndDate)); }
public RdfXmlResult(XElement root, XElement series) : base() { if (root.Element(XName.Get("title", "http://purl.org/dc/elements/1.1/")) != null) Title = new TextSyndicationContent(root.Element(XName.Get("title", "http://purl.org/dc/elements/1.1/")).Value); if (root.Element(XName.Get("created", "http://purl.org/dc/terms/")) != null) PublishDate = DateTime.Parse(root.Element(XName.Get("created", "http://purl.org/dc/terms/")).Value); if (root.Element(XName.Get("modified", "http://purl.org/dc/terms/")) != null) LastUpdatedTime = DateTime.Parse(root.Element(XName.Get("modified", "http://purl.org/dc/terms/")).Value); if (root.Element(XName.Get("identifier", "http://purl.org/dc/elements/1.1/")) != null) Identifier = root.Element(XName.Get("identifier", "http://purl.org/dc/elements/1.1/")).Value; // elementExtensions = RdfXmlDocument.XElementsToElementExtensions(root.Elements()); if (root.Element(XName.Get("EarthObservation", OgcHelpers.ALT21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.ALT20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.ATM21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.ATM20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.EOP21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.EOP20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.LMB21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.LMB20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.OPT21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.OPT20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.SAR21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.SAR20)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.SSP21)) == null && root.Element(XName.Get("EarthObservation", OgcHelpers.SSP20)) == null) { ElementExtensions.Add(BuildEarthObservationReader(root, series)); } links = new Collection<SyndicationLink>(); if (root.Attribute(XName.Get("about", RdfXmlDocument.rdfns.NamespaceName)) != null) { links.Add(new SyndicationLink(new Uri(root.Attribute(XName.Get("about", RdfXmlDocument.rdfns.NamespaceName)).Value), "self", "Reference Link", "application/rdf+xml", 0)); } foreach (XElement onlineResource in root.Elements(XName.Get("onlineResource", RdfXmlDocument.dclite4gns.NamespaceName))) { var sizex = root.Element(XName.Get("size", "http://www.genesi-dr.eu/spec/opensearch/extensions/eop/1.0/")); long size = 0; if (sizex != null) long.TryParse(sizex.Value, out size); links.Add(new SyndicationLink(new Uri(onlineResource.Elements().First().Attribute(XName.Get("about", RdfXmlDocument.rdfns.NamespaceName)).Value), "enclosure", "Data", "application/binary", size)); } }
public RdfXmlDocument(IOpenSearchResultCollection results) : base() { if (results.Title != null) Title = results.Title; else Title = new TextSyndicationContent(""); Identifier = results.Identifier; Id = results.Id; duration = results.QueryTimeSpan; openSearchable = results.OpenSearchable; elementExtensions = results.ElementExtensions; TotalResults = results.TotalResults; Links = results.Links; Authors = results.Authors; LastUpdatedTime = results.LastUpdatedTime; if (results.Items != null) { items = new List<RdfXmlResult>(); foreach (var item in results.Items) { var newItem = new RdfXmlResult(item); newItem.Parent = this; items.Add(newItem); } } series = new XElement(dclite4gns + "Series", new XElement(dcns + "identifier", Identifier), new XElement(dcns + "title", Title.Text), new XAttribute(rdfns + "about", Id) ); }