Argotic syndication framework generates RSS

Source: Internet
Author: User
Using system. IO;
Using argotic. Syndication;

Rssfeed feed = new rssfeed ();

Feed. Channel. Link = new uri ("http: // localhost ");
Feed. Channel. Title = "simple RSS feed ";
Feed. Channel. Description = "a minimal RSS 2.0 syndication feed .";

Rssitem item = new rssitem ();
Item. Title = "simple RSS item ";
Item. Link = new uri ("http: // localhost/items/simplerssitem. aspx ");
Item. Description = "a minimal RSS channel item .";

Feed. Channel. additem (item );

Using (filestream stream = new filestream ("simplerssfeed. xml", filemode. Create, fileaccess. Write ))
{
Feed. Save (Stream );
}
Example 2:
Using system. IO;
Using argotic. Common;
Using argotic. Syndication;

Rssfeed feed = new rssfeed ();

Feed. Channel. Link = new uri ("http: // localhost ");
Feed. Channel. Title = "Compact RSS feed ";
Feed. Channel. Description = "a minimal and non-indented RSS 2.0 syndication feed .";

Rssitem item = new rssitem ();
Item. Title = "simple RSS item ";
Item. Link = new uri ("http: // localhost/items/simplerssitem. aspx ");
Item. Description = "a minimal RSS channel item .";

Feed. Channel. additem (item );

Using (filestream stream = new filestream ("compactrssfeed. xml", filemode. Create, fileaccess. Write ))
{
Syndicationresourcesavesettings settings = new syndicationresourcesavesettings ();
Settings. minimizeoutputsize = true;

Feed. Save (stream, settings );
}

If the output on the current page is as follows:Code:

Response. contenttype = "application/RSS + XML ";
Syndicationresourcesavesettings settings = new syndicationresourcesavesettings ();
Settings. characterencoding = new utf8encoding (false );
Feed. Save (response. outputstream, settings );

 

Example of reading:

 

Using argotic. Extensions. core;
Using argotic. Syndication;

Rssfeed feed = new rssfeed (New uri ("http://example.com/feed.aspx"), "simple extended syndication feed ");
Feed. Channel. Description = "an example of how to generate an extended syndication feed .";

// Create and add iTunes information to feed Channel
Itunessyndicationextension channelextension = new itunessyndicationextension ();
Channelextension. Context. Subtitle = "this feed uses the iTunes syndication extension .";
Channelextension. Context. explicitmaterial = itunesexplicitmaterial. No;
Channelextension. Context. Author = "John Doe ";
Channelextension. Context. Summary = "The argotic syndication framework natively supports the iTunes syndication extension .";
Channelextension. Context. Owner = new itunesowner ("john.doe@example.com", "John Q. Doe ");
Channelextension. Context. Image = new uri ("http://example.com.feed _logo.jpg ");

Channelextension. Context. categories. Add (New itunescategory ("extensions "));
Channelextension. Context. categories. Add (New itunescategory ("ITunes "));

Feed. Channel. addextension (channelextension );

// Create and add iTunes information to channel item
Rssitem item = new rssitem ();
Item. Title = "my extended channel item ";
Item. Link = new uri ("http://example.com/posts/1234 ");
Item. publicationdate = datetime. now;

Rssenclosure enclosure = new rssenclosure (47156978l, "audio/MP3", new uri ("http://example.com/myPodcast.mp3 "));
Item. enclosures. Add (enclosure );

Itunessyndicationextension itemextension = new itunessyndicationextension ();
Itemextension. Context. Author = "Jane Doe ";
Itemextension. Context. Subtitle = "this channel item uses the iTunes syndication extension .";
Itemextension. Context. Summary = "the iTunes syndication extension properties that are used vary based on whether extending the channel or an item ";
Itemextension. Context. Duration = new timespan (1, 2, 13 );
Itemextension. Context. Keywords. Add ("podcast ");
Itemextension. Context. Keywords. Add ("ITunes ");

Item. addextension (itemextension );

Feed. Channel. additem (item );

// Persist extended feed
Using (filestream stream = new filestream ("extendedfeed. RSS. xml", filemode. Create, fileaccess. Write ))
{
Feed. Save (Stream );
}

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.