SyndicationItem.GetRss20Formatter Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Rss20FeedFormatter Pobiera wystąpienie.
Przeciążenia
GetRss20Formatter() |
Rss20FeedFormatter Pobiera wystąpienie. |
GetRss20Formatter(Boolean) |
Rss20FeedFormatter Pobiera wystąpienie. |
GetRss20Formatter()
Rss20FeedFormatter Pobiera wystąpienie.
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
Zwraca
Wystąpienie Rss20FeedFormatter .
Przykłady
Poniższy kod pokazuje, jak napisać element syndykacji w formacie RSS 2.0 do pliku XML.
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()
Dotyczy
GetRss20Formatter(Boolean)
Rss20FeedFormatter Pobiera wystąpienie.
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
Parametry
- serializeExtensionsAsAtom
- Boolean
Wartość określająca, czy serializować rozszerzenia elementów i atrybutów za pomocą przestrzeni nazw Atom 1.0.
Zwraca
Wystąpienie Rss20FeedFormatter .
Przykłady
Poniższy kod pokazuje, jak napisać element syndykacji w formacie RSS 2.0 do pliku XML, serializacji atrybutów i rozszerzeń elementów.
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()
Uwagi
Funkcja RSS 2.0 zezwala na elementy i atrybuty, które nie są w jego specyfikacji tylko wtedy, gdy znajdują się w przestrzeni nazw. serializedExtensionsAsAtom
Gdy parametr ma true
wartość , formatator automatycznie dodaje przestrzeń nazw "a10" do wszystkich rozszerzeń. W przeciwnym razie rozszerzenia nie są serializowane.