Rss C Library 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.

Create/Dispose

HCkRss CkRss_Create(void);

Creates an instance of the CkRss object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkRss_Dispose(HCkRss handle);

Objects created by calling CkRss_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

C "Properties"

void CkRss_getLastErrorHtml(HCkRss cHandle, HCkString retval);

Error information in HTML format for the last method called.

void CkRss_getLastErrorText(HCkRss cHandle, HCkString retval);

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

void CkRss_getLastErrorXml(HCkRss cHandle, HCkString retval);

Error information in XML format for the last method called.

int CkRss_getNumChannels(HCkRss cHandle);

The number of channels in the RSS document.

int CkRss_getNumItems(HCkRss cHandle);

The number of items in the channel.

BOOL CkRss_getUtf8(HCkRss cHandle);
void CkRss_putUtf8(HCkRss cHandle, BOOL newVal);

To be documented soon...

C "Methods"

HCkRss CkRss_AddNewChannel(HCkRss cHandle);

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

HCkRss CkRss_AddNewImage(HCkRss cHandle);

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

HCkRss CkRss_AddNewItem(HCkRss cHandle);

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

BOOL CkRss_DownloadRss(HCkRss cHandle, const char *url);

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

BOOL CkRss_GetAttr(HCkRss cHandle, const char *tag, const char *attrName, HCkString outStr);

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").

HCkRss CkRss_GetChannel(HCkRss cHandle, 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.

int CkRss_GetCount(HCkRss cHandle, const char *tag);

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

BOOL CkRss_GetDate(HCkRss cHandle, const char *tag, SYSTEMTIME *outSysTime);

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

HCkRss CkRss_GetImage(HCkRss cHandle);

Return the image associated with the channel.

int CkRss_GetInt(HCkRss cHandle, const char *tag);

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

HCkRss CkRss_GetItem(HCkRss cHandle, int index);

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

BOOL CkRss_GetString(HCkRss cHandle, const char *tag, HCkString outStr);

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

BOOL CkRss_LoadRssFile(HCkRss cHandle, const char *filename);

Load an RSS document from a file.

BOOL CkRss_LoadRssString(HCkRss cHandle, const char *rssString);

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

BOOL CkRss_MGetAttr(HCkRss cHandle, const char *tag, int index, const char *attrName, HCkString outStr);

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").

BOOL CkRss_MGetString(HCkRss cHandle, const char *tag, int index, HCkString outStr);

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

BOOL CkRss_MSetAttr(HCkRss cHandle, const char *tag, int index, const char *attrName, const char *value);

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

BOOL CkRss_MSetString(HCkRss cHandle, const char *tag, int index, const char *value);

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

void CkRss_NewRss(HCkRss cHandle);

Clears the RSS document.

void CkRss_Remove(HCkRss cHandle, const char *tag);

Removes a sub-element from the RSS document.

BOOL CkRss_SaveLastError(HCkRss cHandle, const char *filename);

Saves the last error information to an XML formatted file.

void CkRss_SetAttr(HCkRss cHandle, const char *tag, const char *attrName, const char *value);

Sets the value of a sub-element attribute.

void CkRss_SetDate(HCkRss cHandle, const char *tag, SYSTEMTIME *dateTime);

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

void CkRss_SetDateNow(HCkRss cHandle, const char *tag);

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

void CkRss_SetInt(HCkRss cHandle, const char *tag, int value);

Sets the value of an integer sub-element.

void CkRss_SetString(HCkRss cHandle, const char *tag, const char *value);

Sets the value of a sub-element.

BOOL CkRss_ToXmlString(HCkRss cHandle, HCkString outStr);

Returns the RSS document as an XML string.

const char *CkRss_getAttr(HCkRss cHandle, const char *tag, const char *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

const char *CkRss_getString(HCkRss cHandle, const char *tag);

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

Returns a null on failure

const char *CkRss_lastErrorHtml(HCkRss cHandle);

Error information in HTML format for the last method called.

Returns a null on failure

const char *CkRss_lastErrorText(HCkRss cHandle);

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

Returns a null on failure

const char *CkRss_lastErrorXml(HCkRss cHandle);

Error information in XML format for the last method called.

Returns a null on failure

const char *CkRss_mGetAttr(HCkRss cHandle, const char *tag, int index, const char *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

const char *CkRss_mGetString(HCkRss cHandle, const char *tag, int index);

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

Returns a null on failure

const char *CkRss_toXmlString(HCkRss cHandle);

Returns the RSS document as an XML string.

Returns a null on failure