module Rss:sig
..end
Reference:
RSS
2.0 specification.
typedate =
Netdate.t
val string_of_date : ?fmt:string -> date -> string
fmt
.fmt
: The format string. It consists of zero or more
conversion specifications and ordinary characters. All ordinary
characters are kept as such in the final string. A conversion
specification consists of the '%' character and one other
character. See Netdate.format_to
for more details.
Default: "%d %b %Y"
.typeemail =
string
typepics_rating =
string
typeskip_hours =
int list
typeskip_days =
int list
typeurl =
Neturl.url
type
category = {
|
cat_name : |
(* |
A forward-slash-separated string that identifies a hierarchic
location in the indicated taxonomy.
| *) |
|
cat_domain : |
(* |
Identifies a categorization taxonomy.
| *) |
type
image = {
|
image_url : |
(* |
The URL of a GIF, JPEG or PNG image that represents the channel.
| *) |
|
image_title : |
(* |
Description of the image, it's used in the ALT attribute of
the HTML <img> tag when the channel is rendered in HTML.
| *) |
|
image_link : |
(* |
The URL of the site, when the channel is rendered, the image
is a link to the site. (Note, in practice the
image_title
and image_link should have the same value as the Rss.channel 's
ch_title and ch_link .) | *) |
|
image_height : |
(* |
Height of the image, in pixels.
| *) |
|
image_width : |
(* |
Width of the image, in pixels.
| *) |
|
image_desc : |
(* |
Text to be included in the "title" attribute of the link formed
around the image in the HTML rendering.
| *) |
type
text_input = {
|
ti_title : |
(* |
The label of the Submit button in the text input area.
| *) |
|
ti_desc : |
(* |
Explains the text input area.
| *) |
|
ti_name : |
(* |
The name of the text object in the text input area.
| *) |
|
ti_link : |
(* |
The URL of the CGI script that processes text input requests.
| *) |
type
enclosure = {
|
encl_url : |
(* |
URL of the enclosure
| *) |
|
encl_length : |
(* |
size in bytes
| *) |
|
encl_type : |
(* |
MIME type
| *) |
type
guid =
| |
Guid_permalink of |
(* |
A permanent URL pointing to the story.
| *) |
| |
Guid_name of |
(* |
A string that uniquely identifies the item.
| *) |
type
source = {
|
src_name : |
|
src_url : |
type
cloud = {
|
cloud_domain : |
|
cloud_port : |
|
cloud_path : |
|
cloud_register_procedure : |
|
cloud_protocol : |
type 'a
item_t = {
|
item_title : |
(* |
Optional title
| *) |
|
item_link : |
(* |
Optional link
| *) |
|
item_desc : |
(* |
Optional description
| *) |
|
item_pubdate : |
(* |
Date of publication
| *) |
|
: |
(* |
The email address of the author of the item.
| *) |
|
item_categories : |
(* |
Categories for the item. See the field
Rss.category . | *) |
|
item_comments : |
(* |
Url of comments about this item
| *) |
|
item_enclosure : |
|||
|
item_guid : |
(* |
A globally unique identifier for the item.
| *) |
|
item_source : |
|||
|
item_data : |
(* |
Additional data, since RSS can be extended with namespace-prefixed nodes.
| *) |
typenamespace =
string * string
type ('a, 'b)
channel_t = {
|
ch_title : |
(* |
Mandatory. The name of the channel, for example the title of
your web site.
| *) |
|
ch_link : |
(* |
Mandatory. The URL to the HTML website corresponding to the channel.
| *) |
|
ch_desc : |
(* |
Mandatory. A sentence describing the channel.
| *) |
|
ch_language : |
(* |
Language of the news, e.g. "en". See the W3C
language codes.
| *) |
|
ch_copyright : |
(* |
Copyright notice.
| *) |
|
ch_managing_editor : |
(* |
Managing editor of the news.
| *) |
|
ch_webmaster : |
(* |
The address of the webmasterof the site.
| *) |
|
ch_pubdate : |
(* |
Publication date of the channel.
| *) |
|
ch_last_build_date : |
(* |
When the channel content changed for the last time.
| *) |
|
ch_categories : |
(* |
Categories for the channel. See the field
Rss.category . | *) |
|
ch_generator : |
(* |
The tool used to generate this channel.
| *) |
|
ch_cloud : |
(* |
Allows processes to register with a cloud to be notified of updates to the channel.
| *) |
|
ch_docs : |
(* |
An url to a RSS format reference.
| *) |
|
ch_ttl : |
(* |
Time to live, in minutes. It indicates how long a channel can
be cached before refreshing from the source.
| *) |
|
ch_image : |
|||
|
ch_rating : |
(* |
The PICS rating for the channel.
| *) |
|
ch_text_input : |
|||
|
ch_skip_hours : |
(* |
A hint for aggregators telling them which hours they can skip.
| *) |
|
ch_skip_days : |
(* |
A hint for aggregators telling them which days they can skip.
| *) |
|
ch_items : |
|||
|
ch_data : |
(* |
Additional data, since RSS can be extended with namespace-prefixed nodes.
| *) |
|
ch_namespaces : |
typeitem =
unit item_t
typechannel =
(unit, unit) channel_t
val item : ?title:string ->
?link:url ->
?desc:string ->
?pubdate:date ->
?author:email ->
?cats:category list ->
?comments:url ->
?encl:enclosure ->
?guid:guid -> ?source:source -> ?data:'a -> unit -> 'a item_t
item()
creates a new item with all fields set to None
. Use the
optional parameters to set fields.val channel : title:string ->
link:url ->
desc:string ->
?language:string ->
?copyright:string ->
?managing_editor:email ->
?webmaster:email ->
?pubdate:date ->
?last_build_date:date ->
?cats:category list ->
?generator:string ->
?cloud:cloud ->
?docs:url ->
?ttl:int ->
?image:image ->
?rating:pics_rating ->
?text_input:text_input ->
?skip_hours:skip_hours ->
?skip_days:skip_days ->
?data:'a ->
?namespaces:namespace list ->
'b item_t list -> ('a, 'b) channel_t
channel items
creates a new channel containing items
. Other
fields are set to None
unless the corresponding optional
parameter is used.val compare_item : ?comp_data:('a -> 'a -> int) -> 'a item_t -> 'a item_t -> int
val copy_item : 'a item_t -> 'a item_t
val copy_channel : ('a, 'b) channel_t -> ('a, 'b) channel_t
val keep_n_items : int -> ('a, 'b) channel_t -> ('a, 'b) channel_t
keep_n_items n ch
returns a copy of the channel, keeping only
n
items maximum.val sort_items_by_date : 'a item_t list -> 'a item_t list
val merge_channels : ('a, 'b) channel_t -> ('a, 'b) channel_t -> ('a, 'b) channel_t
merge_channels c1 c2
merges the given channels in a new channel,
sorting items using Rss.sort_items_by_date
. Channel information are
copied from the first channel c1
.type
xmltree =
| |
E of |
| |
D of |
val xml_of_source : Xmlm.source -> xmltree
Failure
in case of error.exception Error of string
make_opts
used
to read additional data from prefixed XML nodes.type ('a, 'b)
opts
val make_opts : ?schemes:(string, Neturl.url_syntax) Hashtbl.t ->
?base_syntax:Neturl.url_syntax ->
?read_channel_data:(xmltree list -> 'a option) ->
?read_item_data:(xmltree list -> 'b option) -> unit -> ('a, 'b) opts
schemes
and base_syntax
options.
They are used to parse URLs.read_channel_data
: provides a way to read additional information from the
subnodes of the channels. All these subnodes are prefixed by an expanded namespace.read_item_data
: is the equivalent of read_channel_data
parameter but
is called of each item with its prefixed subnodes.val default_opts : (unit, unit) opts
val channel_t_of_file : ('a, 'b) opts -> string -> ('a, 'b) channel_t * string list
channel_[t_]of_X
returns the parsed channel and a list of encountered errors.
Note that only namespaces declared in the root not of the XML tree are added to ch_namespaces
field.Failure
if the channel could not be parsed.val channel_t_of_string : ('a, 'b) opts -> string -> ('a, 'b) channel_t * string list
val channel_t_of_channel : ('a, 'b) opts ->
Pervasives.in_channel -> ('a, 'b) channel_t * string list
val channel_t_of_xmls : ('a, 'b) opts -> xmltree list -> ('a, 'b) channel_t * string list
"channel"
XML node
of a reguler RSS document.val channel_of_file : string -> channel * string list
val channel_of_string : string -> channel * string list
val channel_of_channel : Pervasives.in_channel -> channel * string list
type'a
data_printer ='a -> xmltree list
val print_channel : ?channel_data_printer:'a data_printer ->
?item_data_printer:'b data_printer ->
?indent:int ->
?date_fmt:string ->
?encoding:string -> Format.formatter -> ('a, 'b) channel_t -> unit
val print_file : ?channel_data_printer:'a data_printer ->
?item_data_printer:'b data_printer ->
?indent:int ->
?date_fmt:string ->
?encoding:string -> string -> ('a, 'b) channel_t -> unit