SyndicationFeed クラス

定義

トップレベルのフィード オブジェクトである、Atom 1.0 の <feed> と RSS 2.0 の <rss> を表します。

public ref class SyndicationFeed
public class SyndicationFeed
type SyndicationFeed = class
Public Class SyndicationFeed
継承
SyndicationFeed

SyndicationFeed インスタンスを作成し、Atom 1.0 と RSS 2.0 の両方にシリアル化する方法を次のコードに示します。

SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);
// Add a custom attribute.
XmlQualifiedName xqName = new XmlQualifiedName("CustomAttribute");
feed.AttributeExtensions.Add(xqName, "Value");

SyndicationPerson sp = new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg");
feed.Authors.Add(sp);

SyndicationCategory category = new SyndicationCategory("FeedCategory", "CategoryScheme", "CategoryLabel");
feed.Categories.Add(category);

feed.Contributors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://lene/aaling"));
feed.Copyright = new TextSyndicationContent("Copyright 2007");
feed.Description = new TextSyndicationContent("This is a sample feed");

// Add a custom element.
XmlDocument doc = new XmlDocument();
XmlElement 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");

TextSyndicationContent textContent = new TextSyndicationContent("Some text content");
SyndicationItem item = new SyndicationItem("Item Title", textContent, new Uri("http://server/items"), "ItemID", DateTime.Now);

List<SyndicationItem> items = new List<SyndicationItem>();
items.Add(item);
feed.Items = items;

feed.Language = "en-us";
feed.LastUpdatedTime = DateTime.Now;

SyndicationLink link = new SyndicationLink(new Uri("http://server/link"), "alternate", "Link Title", "text/html", 1000);
feed.Links.Add(link);

XmlWriter atomWriter = XmlWriter.Create("atom.xml");
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(feed);
atomFormatter.WriteTo(atomWriter);
atomWriter.Close();

XmlWriter rssWriter = XmlWriter.Create("rss.xml");
Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
rssFormatter.WriteTo(rssWriter);
rssWriter.Close();
Dim feed As SyndicationFeed = New SyndicationFeed("Feed Title", "Feed Description", New Uri("http:'Feed/Alternate/Link"), "FeedID", DateTime.Now)
' Add a custom attribute.
Dim xqName As XmlQualifiedName = New XmlQualifiedName("CustomAttribute")
feed.AttributeExtensions.Add(xqName, "Value")

Dim sp As SyndicationPerson = New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:'jesper/aaberg")
feed.Authors.Add(sp)

Dim category As SyndicationCategory = New SyndicationCategory("FeedCategory", "CategoryScheme", "CategoryLabel")
feed.Categories.Add(category)

feed.Contributors.Add(New SyndicationPerson("Lene@contoso.com", "Lene Aaling", "http:'Lene/Aaling"))
feed.Copyright = New TextSyndicationContent("Copyright 2007")
feed.Description = New TextSyndicationContent("This is a sample feed")

' Add a custom element.
Dim doc As XmlDocument = New XmlDocument()
Dim feedElement As XmlElement = 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")

Dim textContent As TextSyndicationContent = New TextSyndicationContent("Some text content")
Dim item As SyndicationItem = New SyndicationItem("Item Title", textContent, New Uri("http:'server/items"), "ItemID", DateTime.Now)

Dim items As Collection(Of SyndicationItem) = New Collection(Of SyndicationItem)()
items.Add(item)
feed.Items = items

feed.Language = "en-us"
feed.LastUpdatedTime = DateTime.Now

Dim link As SyndicationLink = New SyndicationLink(New Uri("http:'server/link"), "alternate", "Link Title", "text/html", 1000)
feed.Links.Add(link)

Dim atomWriter As XmlWriter = XmlWriter.Create("atom.xml")
Dim atomFormatter As Atom10FeedFormatter = New Atom10FeedFormatter(feed)
atomFormatter.WriteTo(atomWriter)
atomWriter.Close()

Dim rssWriter As XmlWriter = XmlWriter.Create("rss.xml")
Dim rssFormatter As Rss20FeedFormatter = New Rss20FeedFormatter(feed)
rssFormatter.WriteTo(rssWriter)
rssWriter.Close()

SyndicationFeed を Atom 1.0 にシリアル化する方法を次の XML に示します。

<feed xml:lang="en-us" CustomAttribute="Value" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Feed Title</title>
  <subtitle type="text">This is a sample feed</subtitle>
  <id>FeedID</id>

  <rights type="text">Copyright 2007</rights>
  <updated>2007-04-13T17:29:38Z</updated>
  <category term="FeedCategory" label="CategoryLabel" scheme="CategoryScheme" />
  <logo>http://contoso/image.jpg</logo>
  <author>
    <name>Jesper Aaberg</name>
    <uri>http://contoso/Aaberg</uri>
    <email>Jesper.Asberg@contoso.com</email>
  </author>
  <contributor>
    <name>Lene Aalling</name>
    <uri>http://contoso/Aalling</uri>
    <email>Lene.Aaling@contoso.com</email>
  </contributor>
  <generator>Sample Code</generator>
  <link rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />

  <link customAttribute="value" rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />
  <CustomElement xmlns="">Some text</CustomElement>
  <entry>
    <id>ItemID</id>
    <title type="text">Item Title</title>
    <updated>2007-04-13T17:29:38Z</updated>
    <link rel="alternate" href="http://contoso/items" />
    <content type="text">Some text content</content>
  </entry>

</feed>

SyndicationFeed インスタンスを RSS 2.0 にシリアル化する方法を次の XML に示します。

<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel CustomAttribute="Value">
    <title>Feed Title</title>
    <link>http://feed/Alternate/Link</link>
    <description>This is a sample feed</description>
    <language>en-us</language>

    <copyright>Copyright 2007</copyright>

    <managingEditor>Jesper.Aaberg@contoso.com</managingEditor>
    <lastBuildDate>Fri, 13 Apr 2007 17:29:38 Z</lastBuildDate>
    <category domain="CategoryScheme">FeedCategory</category>
    <a10:link rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />
    <generator>Sample Code</generator>
    
    <a10:contributor>
      <a10:name>Lene Aalling</a10:name>
      <a10:uri>http://contoso/Aalling</a10:uri>
      <a10:email>Lene.Aalling@contoso.com</a10:email>
    </a10:contributor>
    
    <a10:author>
      <a10:name>Lene Aalling</a10:name>
      <a10:uri>http://contoso/Aalling</a10:uri>
      <a10:email>Lene.Aalling@contoso.com</a10:email>
    </a10:author>
    <image>
      <url>http://contoso/image.jpg</url>
      <title>Feed Title</title>
      <link>http://feed/Alternate/Link</link>
    </image>
    <a10:id>FeedID</a10:id>
    <a10:link customAttribute="value" rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />
    
    <CustomElement>Some text</CustomElement>
    <item>
      <guid isPermaLink="false">ItemID</guid>
      <link>http://contoso/items</link>
      <title>Item Title</title>
      <description>Some text content</description>
      <a10:updated>2007-04-13T17:29:38Z</a10:updated>
    </item>
  </channel>
</rss>

注釈

Atom 1.0 にシリアル化すると、 SyndicationFeed インスタンスが 要素に <feed> 書き込まれます。 次の表は、SyndicationFeed に定義されている各プロパティが Atom 1.0 にシリアル化される方法を示しています。

SyndicationFeed プロパティ シリアル化された形式
AttributeExtensions コレクション内の各属性の <feed> 要素内の属性。
Authors <author>コレクション内のそれぞれの SyndicationPerson 要素。
Categories <category>コレクション内のそれぞれの SyndicationCategory 要素。
Contributors <contributor>コレクション内のそれぞれの SyndicationPerson 要素。
Copyright <rights> 要素。
Description <subtitle> 要素。
ElementExtensions コレクション内の各要素は、 要素内に <feed> 書き込まれます。
Generator <generator> 要素。
Id <id> 要素。
ImageUri <logo> 要素。
Items <entry>コレクション内のそれぞれの SyndicationItem 要素。
Language シリアル化されません。
LastUpdatedTime <updated> 要素。
Links <link>コレクション内のそれぞれの SyndicationLink 要素。
Title <title> 要素。

RSS 2.0 にシリアル化する際、SyndicationFeed インスタンスは <rss> 要素に書き込まれます。 次の表は、SyndicationFeed に定義されている各プロパティが RSS 2.0 にシリアル化される方法を示しています。

SyndicationFeed プロパティ シリアル化された形式
AttributeExtensions コレクション内の各属性の <channel> 要素内の属性。
Authors <managingEditor> 1 つだけSyndicationPersonがコレクション内にある場合は 要素。それ以外の場合は、<a10:author>コレクション内の各 SyndicationPerson 要素。
Categories <category>コレクション内のそれぞれの SyndicationCategory 要素。
Contributors <a10:contributor>コレクション内のそれぞれの SyndicationPerson 要素。
Copyright <copyright> 要素。
Description <description> 要素。
ElementExtensions コレクション内の各要素は、 要素内に <channel> 書き込まれます。
Generator <generator> 要素。
Id <a10:id> 要素。
ImageUri <image> 要素。
Items <item>コレクション内のそれぞれの SyndicationItem 要素。
Language <language> 要素。
LastUpdatedTime <lastBuildDate> 要素。
Links <a10:link>コレクション内のそれぞれの SyndicationLink 要素。
Title <title> 要素。

コンストラクター

SyndicationFeed()

SyndicationFeed クラスの新しいインスタンスを初期化します。

SyndicationFeed(IEnumerable<SyndicationItem>)

指定した SyndicationFeed オブジェクトのコレクションを使用して、SyndicationItem クラスの新しいインスタンスを初期化します。

SyndicationFeed(String, String, Uri)

指定したタイトル、説明、および URI (Uniform Resource Identifier) を使用して、SyndicationFeed クラスの新しいインスタンスを初期化します。

SyndicationFeed(String, String, Uri, IEnumerable<SyndicationItem>)

指定したタイトル、説明、URI、および SyndicationFeed オブジェクトのコレクションを使用して、SyndicationItem クラスの新しいインスタンスを初期化します。

SyndicationFeed(String, String, Uri, String, DateTimeOffset)

SyndicationFeed クラスの新しいインスタンスを作成します。

SyndicationFeed(String, String, Uri, String, DateTimeOffset, IEnumerable<SyndicationItem>)

SyndicationFeed クラスの新しいインスタンスを作成します。

SyndicationFeed(SyndicationFeed, Boolean)

指定したフィードを使用して、SyndicationFeed クラスの新しいインスタンスを作成します。

プロパティ

AttributeExtensions

属性の拡張のコレクションを取得します。

Authors

フィードの作成者のコレクションを取得します。

BaseUri

SyndicationFeed インスタンスのベース URI を取得または設定します。

Categories

フィードに対するカテゴリのコレクションを取得します。

Contributors

フィードの投稿者のコレクションを取得します。

Copyright

フィードの著作権情報を取得または設定します。

Description

フィードの説明を取得または設定します。

Documentation

フィードに関するドキュメントへのリンクを取得または設定します。

ElementExtensions

フィードの要素拡張を取得します。

Generator

フィードのジェネレーターを取得または設定します。

Id

フィードの ID を取得または設定します。

ImageUrl

フィードのイメージの URL を取得または設定します。

Items

このフィードに格納されるフィード項目のコレクションを取得します。

Language

フィードの言語を取得または設定します。

LastUpdatedTime

フィードが最後に更新された時刻を取得または設定します。

Links

フィードに関連付けられたリンクを取得します。

SkipDays

フィード用の 'skipDays ' 要素内の値のセットを示す文字列のコレクションを取得します。

SkipHours

フィード用の 'skipHours' 要素内の値のセットを示す整数のコレクションを取得します。

TextInput

フィード用の TextInput プロパティを取得または設定します。

TimeToLive

フィード用の 'ttl' 属性を取得または設定します。

Title

フィードのタイトルを取得または設定します。

メソッド

Clone(Boolean)

SyndicationFeed インスタンスのコピーを作成します。

CreateCategory()

新しい SyndicationCategory のインスタンスを作成します。

CreateItem()

新しい SyndicationItem のインスタンスを作成します。

CreateLink()

新しい SyndicationLink のインスタンスを作成します。

CreatePerson()

新しい SyndicationPerson のインスタンスを作成します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetAtom10Formatter()

Atom10FeedFormatter インスタンスを取得します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetRss20Formatter()

Rss20FeedFormatter インスタンスを取得します。

GetRss20Formatter(Boolean)

新しい Rss20FeedFormatter インスタンスを取得します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
Load(XmlReader)

指定した XML リーダーから配信フィードを読み込みます。

Load<TSyndicationFeed>(XmlReader)

SyndicationFeed の派生インスタンスを、指定した XmlReader から読み込みます。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
SaveAsAtom10(XmlWriter)

配信フィードを、Atom 1.0 形式の指定した XmlWriter に書き込みます。

SaveAsRss20(XmlWriter)

配信フィードを、RSS 2.0 形式の指定した XmlWriter に書き込みます。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TryParseAttribute(String, String, String, String)

属性の拡張の解析を試みます。

TryParseElement(XmlReader, String)

要素拡張の解析を試みます。

WriteAttributeExtensions(XmlWriter, String)

属性の拡張を、指定された配信バージョンを使用して、指定された XmlWriter に書き込みます。

WriteElementExtensions(XmlWriter, String)

要素拡張を、指定した配信バージョンを使用して、指定した XmlWriter に書き込みます。

適用対象