SyndicationItem Klasa

Definicja

Reprezentuje element kanału informacyjnego, na przykład RSS <item> lub Atom <entry>.

public ref class SyndicationItem
public class SyndicationItem
type SyndicationItem = class
Public Class SyndicationItem
Dziedziczenie
SyndicationItem

Przykłady

Poniższy kod pokazuje, jak używać SyndicationItem klasy.

SyndicationItem item = new SyndicationItem("My Item", "This is some content", new Uri("http://SomeServer/MyItem"), "Item ID", DateTime.Now);
item.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
item.Categories.Add(new SyndicationCategory("Category One"));
item.Contributors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://contoso/lene"));
item.Copyright = new TextSyndicationContent("Copyright 2007");
item.Links.Add(new SyndicationLink(new Uri("http://OtherServer/Item"), "alternate", "Alternate Link", "text/html", 1000));
item.PublishDate = new DateTime(2007, 2, 23);
item.Summary = new TextSyndicationContent("this is a summary for my item");
XmlQualifiedName xqName = new XmlQualifiedName("itemAttrib", "http://FeedServer/tags");
item.AttributeExtensions.Add(xqName, "ItemAttribValue");

SyndicationFeed feed = new SyndicationFeed();
Collection<SyndicationItem> items = new Collection<SyndicationItem>();
items.Add(item);
feed.Items = items;
Dim item As SyndicationItem = New SyndicationItem("My Item", "This is some content", New Uri("http:' SomeServer/MyItem"), "Item ID", DateTime.Now)
item.Authors.Add(New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:' contoso/jesper"))
item.Categories.Add(New SyndicationCategory("Category One"))
item.Contributors.Add(New SyndicationPerson("lene@contoso.com", "Lene Aaling", "http:' contoso/lene"))
item.Copyright = New TextSyndicationContent("Copyright 2007")
item.Links.Add(New SyndicationLink(New Uri("http:' OtherServer/Item"), "alternate", "Alternate Link", "text/html", 1000))
item.PublishDate = New DateTime(2007, 2, 23)
item.Summary = New TextSyndicationContent("this is a summary for my item")
Dim xqName As XmlQualifiedName = New XmlQualifiedName("itemAttrib", "http:' FeedServer/tags")
item.AttributeExtensions.Add(xqName, "ItemAttribValue")

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

Uwagi

Po serializacji do atomu 1.0 SyndicationItem wystąpienie jest zapisywane w elemencie <entry> . W poniższej tabeli przedstawiono sposób serializacji każdej właściwości zdefiniowanej SyndicationItem dla programu Atom 1.0.

Właściwość SyndicationItem Formularz serializowany
AttributeExtensions Atrybut w elemecie <entry> .
Authors Element <author> dla każdego autora w kolekcji.
Categories Element <category> .
Content Element <content> .
Contributors Element <contributor> dla każdego współautora w kolekcji.
Copyright Element<rights> .
ElementExtensions Element w elemecie <entry> .
Id Element <id> .
LastUpdatedTime Element <updated> .
Links Element <link> dla każdego linku w kolekcji.
PublishDate Element <published> .
SourceFeed Element <source> .
Summary Element <summary> .
Title Element <title> .

Po serializacji do rss 2.0 SyndicationItem wystąpienie jest zapisywane w elemecie <item> . W poniższej tabeli pokazano, jak każda właściwość zdefiniowana dla SyndicationItem programu jest serializowana dla funkcji RSS 2.0.

Właściwość SyndicationItem Formularz serializowany
AttributeExtensions Atrybut w elemecie <item> .
Authors Jeśli <managingEditor> tylko jeden SyndicationPerson znajduje się w Authors kolekcji; w przeciwnym razie <a10:author> element dla każdego autora w kolekcji.
Categories Element <category> .
Content Element <a10:content> .
Contributors Element <a10:contributor> dla każdej SyndicationPerson z nich w kolekcji Contributors .
Copyright Element <copyright> .
ElementExtensions Element w elemecie <item> .
Id Element <a10:id> .
LastUpdatedTime Element <a10:updated> .
Links Element <link> dla każdej SyndicationLink z nich w kolekcji Links .
PublishDate Element <pubDate> .
SourceFeed Element <source> .
Summary Element <description> .
Title Element <title> .

Konstruktory

SyndicationItem()

Inicjuje nowe wystąpienie klasy SyndicationItem.

SyndicationItem(String, String, Uri)

Inicjuje SyndicationItem nowe wystąpienie klasy z określonym tytułem, zawartością i linkiem.

SyndicationItem(String, String, Uri, String, DateTimeOffset)

Inicjuje nowe wystąpienie klasy SyndicationItem.

SyndicationItem(String, SyndicationContent, Uri, String, DateTimeOffset)

Inicjuje nowe wystąpienie klasy SyndicationItem.

SyndicationItem(SyndicationItem)

Inicjuje SyndicationItem nowe wystąpienie klasy z określonym SyndicationItem wystąpieniem.

Właściwości

AttributeExtensions

Pobiera rozszerzenia atrybutów dla elementu syndykacji.

Authors

Pobiera autorów elementu syndykacji.

BaseUri

Pobiera lub ustawia podstawowy identyfikator URI (Uniform Resource Identifier) dla SyndicationItem wystąpienia.

Categories

Pobiera kategorie syndykacji dla elementu syndykacji.

Content

Pobiera lub ustawia zawartość elementu syndykacji.

Contributors

Pobiera współautorów elementu syndykacji.

Copyright

Pobiera lub ustawia informacje o prawach autorskich dla elementu syndykacji.

ElementExtensions

Pobiera rozszerzenia elementów zawarte w elemencie syndykacji.

Id

Pobiera lub ustawia identyfikator elementu syndykacji.

LastUpdatedTime

Pobiera lub ustawia czas ostatniej aktualizacji elementu syndykacji.

Links

Pobiera linki zawarte w elemencie syndykacji.

PublishDate

Pobiera lub ustawia datę publikacji elementu syndykacji.

SourceFeed

Pobiera lub ustawia źródło danych elementu syndykacji.

Summary

Pobiera lub ustawia podsumowanie elementu syndykacji.

Title

Pobiera lub ustawia tytuł elementu syndykacji.

Metody

AddPermalink(Uri)

Dodaje link permalink do elementu SyndicationItem.

Clone()

Tworzy kopię SyndicationItem wystąpienia.

CreateCategory()

Tworzy nową kategorię.

CreateLink()

Tworzy nowe wystąpienie klasy SyndicationLink.

CreatePerson()

Tworzy nową osobę.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetAtom10Formatter()

Atom10FeedFormatter Pobiera wystąpienie.

GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetRss20Formatter()

Rss20FeedFormatter Pobiera wystąpienie.

GetRss20Formatter(Boolean)

Rss20FeedFormatter Pobiera wystąpienie.

GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
Load(XmlReader)

SyndicationItem Ładuje wystąpienie z określonego XmlReaderobiektu .

Load<TSyndicationItem>(XmlReader)

SyndicationItem Ładuje obiekt pochodny z określonego XmlReaderobiektu .

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
SaveAsAtom10(XmlWriter)

Zapisz element syndykacji do określonego XmlWriter w formacie Atom 1.0.

SaveAsRss20(XmlWriter)

Zapisz element syndykacji do określonego XmlWriter w formacie RSS 2.0.

ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)
TryParseAttribute(String, String, String, String)

Próbuje przeanalizować rozszerzenie atrybutu.

TryParseContent(XmlReader, String, String, SyndicationContent)

Próbuje przeanalizować zawartość.

TryParseElement(XmlReader, String)

Próbuje przeanalizować rozszerzenie elementu.

WriteAttributeExtensions(XmlWriter, String)

Zapisuje rozszerzenia atrybutów do określonej XmlWriter przy użyciu określonej wersji syndykacji.

WriteElementExtensions(XmlWriter, String)

Zapisuje rozszerzenia elementu do określonej XmlWriter przy użyciu określonej wersji syndykacji.

Dotyczy