SyndicationFeed 클래스

정의

최상위 피드 개체인 <feed>(Atom 1.0) 및 <rss>(RSS 2.0)를 나타냅니다.

public ref class SyndicationFeed
public class SyndicationFeed
type SyndicationFeed = class
Public Class SyndicationFeed
상속
SyndicationFeed

예제

다음 코드에서는 SyndicationFeed 인스턴스를 만들고 이를 Atom 1.0 및 RSS 2.0으로 serialize하는 방법을 보여 줍니다.

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으로 serialize되는 방법을 보여 줍니다.

<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으로 serialize되는 방법을 보여 줍니다.

<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel CustomAttribute="Value">
    <title>피드 제목</title>
    <link>http://feed/Alternate/Link</link>
    <description>샘플 피드입니다.</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>피드 제목</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>항목 제목</title>
      <description>일부 텍스트 콘텐츠</description>
      <a10:updated>2007-04-13T17:29:38Z</a10:updated>
    </item>
  </channel>
</rss>

설명

Atom 1.0 SyndicationFeed 으로 직렬화하면 인스턴스가 요소에 <feed> 기록됩니다. 다음 표에서는 SyndicationFeed 클래스에 정의된 각 속성이 어떻게 Atom 1.0으로 serialize되는지 보여 줍니다.

SyndicationFeed 속성 Serialize된 형식
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 serialize되지 않았습니다.
LastUpdatedTime 요소입니다 <updated> .
Links <link> 컬렉션의 각 SyndicationLink 요소입니다.
Title <title> 요소입니다.

RSS 2.0 SyndicationFeed 으로 직렬화되면 인스턴스가 요소에 <rss> 기록됩니다. 다음 표에서는 SyndicationFeed 클래스에 정의된 각 속성이 어떻게 RSS 2.0으로 serialize되는지 보여 줍니다.

SyndicationFeed 속성 Serialize된 형식
AttributeExtensions 컬렉션의 <channel> 각 특성에 대한 요소의 특성입니다.
Authors <managingEditor> 컬렉션에 하나 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)

배포 피드를 지정된 XmlWriter에 Atom 1.0 형식으로 씁니다.

SaveAsRss20(XmlWriter)

배포 피드를 지정된 XmlWriter에 RSS 2.0 형식으로 씁니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
TryParseAttribute(String, String, String, String)

특성 확장의 구문 분석을 시도합니다.

TryParseElement(XmlReader, String)

요소 확장의 구문 분석을 시도합니다.

WriteAttributeExtensions(XmlWriter, String)

지정된 배포 버전을 사용하여 지정된 XmlWriter에 특성 확장을 씁니다.

WriteElementExtensions(XmlWriter, String)

지정된 배포 버전을 사용하여 지정된 XmlWriter에 요소 확장을 씁니다.

적용 대상