SyndicationItem.GetRss20Formatter Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar en Rss20FeedFormatter instans.
Överlagringar
| Name | Description |
|---|---|
| GetRss20Formatter() |
Hämtar en Rss20FeedFormatter instans. |
| GetRss20Formatter(Boolean) |
Hämtar en Rss20FeedFormatter instans. |
GetRss20Formatter()
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
Hämtar en Rss20FeedFormatter instans.
public:
System::ServiceModel::Syndication::Rss20ItemFormatter ^ GetRss20Formatter();
public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter();
member this.GetRss20Formatter : unit -> System.ServiceModel.Syndication.Rss20ItemFormatter
Public Function GetRss20Formatter () As Rss20ItemFormatter
Returer
En Rss20FeedFormatter instans.
Exempel
Följande kod visar hur du skriver ett syndikeringsobjekt i RSS 2.0-format till en XML-fil.
SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"), "itemID", DateTimeOffset.Now);
Rss20ItemFormatter rssFormatter = item.GetRss20Formatter();
XmlWriter writer = XmlWriter.Create("output.xml");
rssFormatter.WriteTo(writer);
writer.Close();
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"), "itemID", DateTimeOffset.Now)
Dim rssFormatter As Rss20ItemFormatter = item.GetRss20Formatter()
Dim writer As XmlWriter = XmlWriter.Create("output.xml")
rssFormatter.WriteTo(writer)
writer.Close()
Gäller för
GetRss20Formatter(Boolean)
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
- Källa:
- SyndicationItem.cs
Hämtar en Rss20FeedFormatter instans.
public:
System::ServiceModel::Syndication::Rss20ItemFormatter ^ GetRss20Formatter(bool serializeExtensionsAsAtom);
public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter(bool serializeExtensionsAsAtom);
member this.GetRss20Formatter : bool -> System.ServiceModel.Syndication.Rss20ItemFormatter
Public Function GetRss20Formatter (serializeExtensionsAsAtom As Boolean) As Rss20ItemFormatter
Parametrar
- serializeExtensionsAsAtom
- Boolean
Ett värde som anger om element- och attributtillägg ska serialiseras med ett Atom 1.0-namnområde.
Returer
En Rss20FeedFormatter instans.
Exempel
Följande kod visar hur du skriver ett syndikeringsobjekt i RSS 2.0-format till en XML-fil, serialiserande attribut och elementtillägg.
SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"), "itemID", DateTimeOffset.Now);
Rss20ItemFormatter rssFormatter = item.GetRss20Formatter(true);
XmlWriter writer = XmlWriter.Create("output.xml");
rssFormatter.WriteTo(writer);
writer.Close();
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"), "itemID", DateTimeOffset.Now)
Dim rssFormatter As Rss20ItemFormatter = item.GetRss20Formatter(True)
Dim writer As XmlWriter = XmlWriter.Create("output.xml")
rssFormatter.WriteTo(writer)
writer.Close()
Kommentarer
RSS 2.0 tillåter element och attribut som inte finns i specifikationen endast om de finns inom ett namnområde. När parametern serializedExtensionsAsAtom är truelägger formateringsfunktionen automatiskt till namnområdet "a10" i alla tillägg. Annars serialiseras inte tilläggen.