RSS
RSSItem
P
rint
C
lose
documented with
GabLibrary Documentor.
(7/1/2007 9:05:56 PM)
Class RSS
^
Reads RSS feeds and gives you the possibility of formating it with xsl or using the items programmatically as objects. Additionally it lets you generate your own feeds. - READING: achieved with load() or draw(). Refer to the methods for the supported versions - WRITING: achiedved with generate(). Refer to the method for the supported versions If caching should be enabled use the setCache() method. By default caching is off. - on draw() caching stores the complete transformed output in the cache - on load() caching stores the xml in the cache and parses it out from the cache.
Version:
1.0
Author:
Michal Gabrukiewicz on 2006-09-08 15:07
Last modified:
01.07.2007 20:13:57
Postfix:
rss
Requires:
Cache
Path:
/RSS/RSS.asp
Properties
^
Name
Type
Description
debug
bool
turns debuging on/off. if on then useful information will be shown which can be used if the feed never loads. e.g. the response of the server, etc. default = false
description
string
description of the feed
failed
bool
indicates if any of the methods load() or draw() e.g. server not responding, timeouts, etc.
items
dictionary
collection of the items (RSSItem). after load() this gets filled - for writing a feed this collection needs to be filled with items which sould be published. use addItem()
language
string
the language of the feed. e.g. en
link
string
link which is associated with the feed
publishedDate
date
date when the feed has been published. you local timezone!
theCache
Cache
holds the cache which is used for caching the feed. by default it is nothing and should only be set by setCache(). afterwards this property can be used.
timeout
int
timeout in seconds for the requests. default = 2
title
string
title of the feed
url
string
url of the RSS feed (necessary for load() and draw())
Methods
^
addItem ( rItem )
adds an item to the items collection
rItem
(
RSSItem
)
: the item you want to add
draw ( xslPath )
draws the RSS feed with a given XSL. if cached then it will be taken from the cache
The whole HTML is taken from the cache and not just the data. so tranformation is performed just once. - supported formats: all because the XSL needs to be provided by the client manually - check failed property after execution
xslPath
(
string
)
: virtual path to the xsl. e.g. /xsl/foo.xsl
generate ( format target )
generates a feed with the given items and the metadata (title, etc.). Returns the generated XMLDOM and provides the possibility to save it into a file immediately
Feed is generate with UTF-8 (Note: your file must be saved as UTF-8 in order to support this). there are two ways to generate the feed: 1. create a file which will be stored on your server (by providing a target param) (normally used if you have an action in your application which invokes the feed generation. e.g. new post in a blog system) 2. getting the XML and using it as desired. e.g. sending to the response (no target param) (normally used if the feed is generated on each feed request - so the feed is an ASP file itself and is generated on each request.) - supported formats: RSS2.0
format
(
string
)
: RSS2.0
target
(
string
)
: path to the file you want to save the feed to. e.g. /feeds/feed.xml leave it empty if you want to get the XML returned
Return
(
microsoft.xmldom
) : the resulted xmldom
load ( )
loads the feed. so the items, title, link, etc. will be set
use this if you want to access e.g. the items of the feed and dont want to use the draw() method using the XSL. Note: using this method wont use the caching! - supported formats: RSS1.0 (RDF), RSS2.0, RSS0.92, RSS0.94 and ATOM - check failed property after execution
reflect ( )
reflection of the properties and its values
Return
(
dictionary
) : key = property-name, value = property value
setCache ( interval value )
sets the caching of the RSS. the Cache class needs to be loaded for this
Specify how long the feed should be cashed till it will be requested again. For more information about the caching look up the Cache class
interval
(
string
)
: m = months, y = year, d = day, etc. everything accepted by dateadd
value
(
int
)
: value for the interval. e.g. 1 for month
Class RSSItem
^
used with the RSSReader
Version:
0.1
Author:
Michal Gabrukiewicz on 2006-11-08 18:15
Last modified:
01.07.2007 19:59:41
Path:
/RSS/class_RSSItem.asp
Properties
^
Name
Type
Description
author
string
author of the item
category
string
name of the category
comments
string
link to the comments of the item (if available)
description
string
content
GUID
string
an unique identifier for the item. usually the same as link
link
string
link to the item
publishedDate
date
date when the item has been published. your local timezone.
title
string
title of the item
Methods
^
reflect ( )
reflection of the properties and its values
Return
(
dictionary
) : key = property-name, value = property value