source: project/wiki/eggref/4/rss @ 15670

Last change on this file since 15670 was 15670, checked in by anonymous, 11 years ago

Added description of enclosure record.

File size: 4.3 KB
Line 
1[[tags: egg]]
2
3== rss
4
5[[toc:]]
6
7=== Description
8
9An RSS parser
10
11=== Author
12
13[[/users/felix winkelmann|felix winkelmann]]
14
15=== Requirements
16
17[[ssax]]
18
19=== Documentation
20
21A basic RSS parser, supporting 0.92, 1.0 and 2.0 formats.
22
23All errors signalled by the feed reader are composite conditions of the {{exn}} and {{rss}} kinds.
24
25<procedure>(rss:read [PORT])</procedure>
26
27Reads an RSS feed from the given {{PORT}}, or from the value of
28{{(current-input-port)}}, if no port is specified. A {{rss:feed}}
29record is returned.
30
31<record>rss:feed</record>
32<procedure>(rss:feed? x)</procedure>
33<procedure>(rss:feed-version FEED)</procedure>
34<procedure>(rss:feed-channel FEED)</procedure>
35<procedure>(rss:feed-items FEED)</procedure>
36
37A record that holds information for an RSS feed. The {{version}} field
38contains a string, the {{channel}} field and the {{items}} hold a
39single {{rss:item}} and a list of {{rss:item}}s, respectively.
40
41<record>rss:item</record>
42<procedure>(rss:item? X)</procedure>
43<procedure>(rss:item-title ITEM)</procedure>
44<procedure>(rss:item-link ITEM)</procedure>
45<procedure>(rss:item-description ITEM)</procedure>
46<procedure>(rss:item-enclosure ITEM)</procedure>
47<procedure>(rss:item-attributes ITEM)</procedure>
48
49A record containing data of a RSS item. The {{title}}, {{link}} and
50{{description}} fields are strings. The {{rss:item-enclosure}}
51procedure returns a {{enclosure}} record (see below). The
52{{attributes}} field holds an association list mapping symbols to
53strings and contain all sub-elements of a specific RSS item, including
54the {{title}}, {{link}} {{description}} and {{enclosure}} values.  So:
55
56  (eq? (alist-ref 'title (rss:item-attributes ITEM)) (rss:item-title ITEM))  ==>  #t
57
58The {{item}} attribute is an SXML expression of the form
59
60  (image (title STRING) ...)
61
62where {{...}} hold additional subelements of the image attribute.
63
64<procedure>(rss:item-attribute ITEM SYMBOL)</procedure>
65
66Returns the attribute {{SYMBOL}} of the RSS feed item {{ITEM}} or
67{{#f}} if the item does not contain an attribute of this name.
68
69<procedure>(rss:item=? ITEM ITEM)</procedure>
70
71Returns {{#t}} if the items have identical GUID attributes or (if no
72GUIDs are available) if the items have the same contents.
73
74<record>rss:enclosure</record>
75
76Holds the url of an embedded file, the mime-type of that file and the
77length in bytes. It's accessors are defined as follows:
78
79<procedure>(rss:renclosure? X)</procedure>
80<procedure>(rss:enclosure-url ENCLOSURE)</procedure>
81<procedure>(rss:enclosure-type ENCLOSURE)</procedure>
82<procedure>(rss:enclosure-length ENCLOSURE)</procedure>
83
84All the returned values are strings.
85
86=== Changelog
87
88* 1.4 improvements by [Christian Kellermann]
89* 1.3 ported to chicken 4
90* 1.2 fixed broken .meta file [reported by Mario Goulart]
91* 1.1 Small fix in {{rss:item=?}} by Daishi Kato
92* 1.0 Initial release
93
94=== License
95
96  Copyright (c) 2004-2009, Felix L. Winkelmann
97  All rights reserved.
98 
99  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
100  conditions are met:
101 
102    Redistributions of source code must retain the above copyright notice, this list of conditions and the following
103      disclaimer.
104    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
105      disclaimer in the documentation and/or other materials provided with the distribution.
106    Neither the name of the author nor the names of its contributors may be used to endorse or promote
107      products derived from this software without specific prior written permission.
108 
109  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
110  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
111  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
112  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
113  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
114  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
115  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
116  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
117  POSSIBILITY OF SUCH DAMAGE.
Note: See TracBrowser for help on using the repository browser.