CkRss Java Programming
Reference Documentation

CkRss

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

// str is a CkString object (output)
LastErrorHtml( str )

Error information in HTML format for the last method called.

// str is a CkString object (output)
LastErrorText( str )

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

// str is a CkString object (output)
LastErrorXml( str )

Error information in XML format for the last method called.

// Returns an integer value
get_NumChannels( )

The number of channels in the RSS document.

// Returns an integer value
get_NumItems( )

The number of items in the channel.

Methods

AddNewChannel( )

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

AddNewImage( )

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

AddNewItem( )

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

// url is a string (input)
// Returns a boolean value
DownloadRss( url )

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

Example: Read RSS Feed

// tag is a string (input)
// attrName is a string (input)
// outStr is a CkString object (output)
// Returns a boolean value
GetAttr( tag, attrName, 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").

Returns true for success, false for failure.

// index is an integer (input)
GetChannel( 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.

// tag is a string (input)
// Returns an integer value
GetCount( tag )

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

// tag is a string (input)
// sysTime is a SYSTEMTIME object (output)
// Returns a boolean value
GetDate( tag, sysTime )

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

GetImage( )

Return the image associated with the channel.

// tag is a string (input)
// Returns an integer value
GetInt( tag )

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

// index is an integer (input)
GetItem( index )

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

// tag is a string (input)
// outStr is a CkString object (output)
// Returns a boolean value
GetString( tag, outStr )

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

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadRssFile( filename )

Load an RSS document from a file.

// rssString is a string (input)
// Returns a boolean value
LoadRssString( rssString )

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

// tag is a string (input)
// idx is an integer (input)
// attrName is a string (input)
// outStr is a CkString object (output)
// Returns a boolean value
MGetAttr( tag, idx, attrName, 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").

Returns true for success, false for failure.

// tag is a string (input)
// idx is an integer (input)
// outStr is a CkString object (output)
// Returns a boolean value
MGetString( tag, idx, outStr )

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

Returns true for success, false for failure.

// tag is a string (input)
// idx is an integer (input)
// attrName is a string (input)
// value is a string (input)
// Returns a boolean value
MSetAttr( tag, idx, attrName, value )

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

// tag is a string (input)
// idx is an integer (input)
// value is a string (input)
// Returns a boolean value
MSetString( tag, idx, value )

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

NewRss( )

Clears the RSS document.

// tag is a string (input)
Remove( tag )

Removes a sub-element from the RSS document.

// filename is a string (input)
// Returns a boolean value
SaveLastError( filename )

Saves the last error information to an XML formatted file.

// tag is a string (input)
// attrName is a string (input)
// value is a string (input)
SetAttr( tag, attrName, value )

Sets the value of a sub-element attribute.

// tag is a string (input)
// d is a SYSTEMTIME object (output)
SetDate( tag, d )

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

// tag is a string (input)
SetDateNow( tag )

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

// tag is a string (input)
// value is an integer (input)
SetInt( tag, value )

Sets the value of an integer sub-element.

// tag is a string (input)
// value is a string (input)
SetString( tag, value )

Sets the value of a sub-element.

// outStr is a CkString object (output)
// Returns a boolean value
ToXmlString( outStr )

Returns the RSS document as an XML string.

Returns true for success, false for failure.

// tag is a string (input)
// attrName is a string (input)
// Returns a string
getAttr( tag, 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").

// tag is a string (input)
// Returns a string
getString( tag )

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

// Returns a string
lastErrorHtml( )

Error information in HTML format for the last method called.

// Returns a string
lastErrorText( )

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

// Returns a string
lastErrorXml( )

Error information in XML format for the last method called.

// tag is a string (input)
// idx is an integer (input)
// attrName is a string (input)
// Returns a string
mGetAttr( tag, idx, 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").

// tag is a string (input)
// idx is an integer (input)
// Returns a string
mGetString( tag, idx )

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

// Returns a string
toXmlString( )

Returns the RSS document as an XML string.