Edit

Share via


SyndicationItem.GetRss20Formatter Method

Definition

Gets an Rss20FeedFormatter instance.

Overloads

GetRss20Formatter()

Gets an Rss20FeedFormatter instance.

GetRss20Formatter(Boolean)

Gets an Rss20FeedFormatter instance.

GetRss20Formatter()

Source:
SyndicationItem.cs
Source:
SyndicationItem.cs
Source:
SyndicationItem.cs
Source:
SyndicationItem.cs

Gets an Rss20FeedFormatter instance.

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

Returns

An Rss20FeedFormatter instance.

Examples

The following code shows how to write a syndication item in RSS 2.0 format to an XML file.

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

Applies to

GetRss20Formatter(Boolean)

Source:
SyndicationItem.cs
Source:
SyndicationItem.cs
Source:
SyndicationItem.cs
Source:
SyndicationItem.cs

Gets an Rss20FeedFormatter instance.

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

Parameters

serializeExtensionsAsAtom
Boolean

A value that specifies whether to serialize element and attribute extensions with an Atom 1.0 namespace.

Returns

An Rss20FeedFormatter instance.

Examples

The following code shows how to write a syndication item in RSS 2.0 format to an XML file, serializing attribute and element extensions.

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

Remarks

RSS 2.0 allows elements and attributes that are not in its specification only if they are within a namespace. When the serializedExtensionsAsAtom parameter is true, the formatter automatically adds the "a10" namespace to all extensions; otherwise, the extensions are not serialized.

Applies to