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()

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

<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>

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

<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, IEnumerable<SyndicationItem>)

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

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

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

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

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

SyndicationFeed(String, String, Uri)

指定したタイトル、説明、および URI (Uniform Resource Identifier) を使用して、 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 に要素拡張を書き込みます。

適用対象