Chilkat C# Rss Class Reference

Rss

Represents an RSS document or sub-part of a document such as a channel, image, or item. The RSS API allows one to download, create and modify RSS documents.

Properties

public bool EnableEvents {get; set; }

To be documented soon...

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

public int NumChannels {get; }

The number of channels in the RSS document.

public int NumItems {get; }

The number of items in the channel.

Methods

public Rss AddNewChannel();

Adds a new channel to the RSS document. Returns the Rss object representing the Channel which can then be edited.

public Rss AddNewImage();

Adds a new image to the RSS document. Returns the Rss object representing the image, which can then be edited.

public Rss AddNewItem();

Adds a new Item to an Rss channel. Returns the Rss object representing the item which can then be edited.

public bool DownloadRss(string url);

Downloads an RSS document from the Internet and populates the Rss object with the contents.

Example: Read RSS Feed

public string GetAttr(string tag, string attrName);

Returns the value of a sub-element attribute. For example, to get the value of the "isPermaLink" attribute of the "guid" sub-element, call item.GetAttr("guid","isPermaLink").

Returns a null on failure

public Rss GetChannel(int index);

Returns the Nth channel of an RSS document. Usually there is only 1 channel per document, so the index argument should be set to 0.

public int GetCount(string tag);

Return the number of sub-elements with a specific tag.

public DateTime GetDate(string tag);

Return the value of a sub-element in date/time format.

public Rss GetImage();

Return the image associated with the channel.

public int GetInt(string tag);

Return the value of a numeric sub-element as an integer.

public Rss GetItem(int index);

Return the Nth item of a channel as an RSS object.

public string GetString(string tag);

Return the value of an sub-element as a string.

Returns a null on failure

public bool LoadRssFile(string filename);

Load an RSS document from a file.

public bool LoadRssString(string rssString);

Loads an RSS feed document from an in-memory string.

public string MGetAttr(string tag, int idx, string attrName);

Get an attribute value for the Nth sub-element having a specific tag. As an example, an RSS item may have several "category" sub-elements. To get the value of the "domain" attribute for the 3rd category, call MGetAttr("category",2,"domain").

Returns a null on failure

public string MGetString(string tag, int idx);

Get the value of the Nth occurance of a sub-element. Indexing begins at 0.

Returns a null on failure

public bool MSetAttr(string tag, int idx, string attrName, string value);

Set an attribute on the Nth occurance of a sub-element.

public bool MSetString(string tag, int idx, string value);

Set the value of the Nth occurance of a sub-element. Indexing begins at 0.

public void NewRss();

Clears the RSS document.

public void Remove(string tag);

Removes a sub-element from the RSS document.

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public void SetAttr(string tag, string attrName, string value);

Sets the value of a sub-element attribute.

public void SetDate(string tag, DateTime d);

Sets the value of a date/time sub-element.

public void SetDateNow(string tag);

Sets the value of a date/time sub-element to the current system date/time.

public void SetInt(string tag, int value);

Sets the value of an integer sub-element.

public void SetString(string tag, string value);

Sets the value of a sub-element.

public string ToXmlString();

Returns the RSS document as an XML string.

Returns a null on failure