Advertisement
Ramkoti

Untitled

Sep 29th, 2023
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. # X.Web.RSS
  2. [![NuGet version](https://badge.fury.io/nu/xwebrss.svg)](https://badge.fury.io/nu/xwebrss)
  3. [![Part of awesome .NET Core](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/thangchung/awesome-dotnet-core#tools)
  4.  
  5. This project you also can download from Nuget.org at http://nuget.org/packages/xwebrss/
  6.  
  7. ## W3C Validagtion ![Valid RSS](https://validator.w3.org/feed/images/valid-rss-rogers.png)
  8. RSS feeds which generated by this library successfully pass W3C validation.
  9. You can test your RSS feeds at http://validator.w3.org/feed.
  10.  
  11. ## Introduction
  12. Easy to use library to create simple rss feeds and read foreign rss feeds.
  13. All processes are based on XmlSerializer and can be used as an example of how to use XmlSerializer :)
  14.  
  15.  
  16. ## Usage example
  17. To read foreign rss feed you need to get stream with rss data and call `RSSHelper.ReadRSS`
  18.  
  19. var request = WebRequest.Create("http://example.org/rss/");
  20. var response = request.GetResponse();
  21. var stream = response.GetResponseStream();
  22. Rss rss = RSSHelper.ReadRSS(stream);
  23. Assert.AreEqual("Example", rss.Channel.Title);
  24.  
  25. ### RSS object creating example
  26.  
  27. Complete rss object will looks like this:
  28.  
  29. return new RssDocument
  30. {
  31. Channel =
  32. new RssChannel
  33. {
  34. AtomLink = new RssLink { Href = new RssUrl("http://atomlink.com"), Rel = Rel.self, Type = "text/plain" },
  35. Category = "category",
  36. Cloud =
  37. new RssCloud
  38. {
  39. Domain = "domain",
  40. Path = "path",
  41. Port = 1234,
  42. Protocol = Protocol.xmlrpc,
  43. RegisterProcedure = "registerProcedure"
  44. },
  45. Copyright = "copyrignt (c)",
  46. Description = "long description",
  47. Image =
  48. new RssImage
  49. {
  50. Description = "Image Description",
  51. Height = 100,
  52. Width = 100,
  53. Link = new RssUrl("http://image.link.url.com"),
  54. Title = "title",
  55. Url = new RssUrl("http://image.url.com")
  56. },
  57. Language = new CultureInfo("en"),
  58. LastBuildDate = new DateTime(2011, 7, 17, 15, 55, 41),
  59. Link = new RssUrl("http://channel.url.com"),
  60. ManagingEditor = new RssEmail("managingEditor@mail.com (manager)"),
  61. PubDate = new DateTime(2011, 7, 17, 15, 55, 41),
  62. Rating = "rating",
  63. SkipDays = new List<Day> { Day.Thursday, Day.Wednesday },
  64. SkipHours = new List<Hour> { new Hour(22), new Hour(15), new Hour(4) },
  65. TextInput =
  66. new RssTextInput
  67. {
  68. Description = "text input desctiption",
  69. Link = new RssUrl("http://text.input.link.com"),
  70. Name = "text input name",
  71. Title = "text input title"
  72. },
  73. Title = "channel title",
  74. TTL = 10,
  75. WebMaster = new RssEmail("webmaster@mail.example.com (webmaster)"),
  76. Items =
  77. new List<RssItem>
  78. {
  79. new RssItem
  80. {
  81. Author = new RssEmail("item.author@mail.example.com (author)"),
  82. Category =
  83. new RssCategory
  84. {
  85. Domain = "category domain value",
  86. Text = "category text value"
  87. },
  88. Comments = new RssUrl("http://rss.item.comment.url.com"),
  89. Description = "item description",
  90. Enclosure =
  91. new RssEnclosure
  92. {
  93. Length = 1234,
  94. Type = "text/plain",
  95. Url = new RssUrl("http://rss.item.enclosure.type.url.com")
  96. },
  97. Link = new RssUrl("http://rss.item.link.url.com"),
  98. PubDate = new DateTime(2011, 7, 17, 15, 55, 41),
  99. Title = "item title",
  100. Guid = new RssGuid { IsPermaLink = false, Value = "guid value" },
  101. Source = new RssSource { Url = new RssUrl("http://rss.item.source.url.com") }
  102. }
  103. }
  104. }
  105. };
  106.  
  107. ## Get a digital subscription for project news
  108. [Subscribe](https://twitter.com/intent/user?screen_name=andrew_gubskiy) to my Twitter to keep up-to-date with project news and receive announcements.
  109.  
  110. [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/andrew_gubskiy.svg?style=social&label=Follow%20%40andrew_gubskiy)](https://twitter.com/andrew_gubskiy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement