xommelier 0.1.16 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,9 @@ Xommelier is an XML Object Mapper. You could describe some namespace (e.g. Atom)
6
6
 
7
7
  Look into {Xommelier::Atom}, {Xommelier::Atom::Threading}, and {Xommelier::Atom::History} module for implementation of http://www.w3.org/2005/Atom namespace, Atom Threading, and Feed Paging and Archiving extensions
8
8
 
9
- Xommelier is work in progress: [![Build Status](https://secure.travis-ci.org/alsemyonov/xommelier.png?branch=master)](http://travis-ci.org/alsemyonov/xommelier)
9
+ Xommelier is work in progress:
10
+ [![Build Status](https://secure.travis-ci.org/alsemyonov/xommelier.png?branch=master)](http://travis-ci.org/alsemyonov/xommelier)
11
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/alsemyonov/xommelier)
10
12
 
11
13
  ## Examples with Atom
12
14
 
@@ -4,6 +4,17 @@ require 'xommelier/core_ext'
4
4
  module Xommelier
5
5
  autoload :Atom, 'xommelier/atom'
6
6
  autoload :OpenSearch, 'xommelier/open_search'
7
+
8
+ # Standard Xommelier Error
9
+ class Error < ::StandardError
10
+ end
11
+
12
+ # This error raised when there are no schema provided but {Xommelier::Xml::Element#valid?} called.
13
+ class NoSchemaError < Error
14
+ def initialize(object)
15
+ super("Cannot validate #{object} because no schema provided for validation.")
16
+ end
17
+ end
7
18
  end
8
19
 
9
20
  require 'xommelier/xml'
@@ -7,7 +7,6 @@ module Xommelier
7
7
  include Xommelier::Xml
8
8
 
9
9
  xmlns 'http://www.w3.org/2005/Atom', as: :atom
10
- #roots :Feed, :Entry
11
10
 
12
11
  # Elements
13
12
  autoload :Link, 'xommelier/atom/link'
@@ -5,8 +5,6 @@ module Xommelier
5
5
  class Entry < Xml::Element
6
6
  include LinksExtension
7
7
 
8
- root
9
-
10
8
  element :id, unique: true
11
9
  element :title
12
10
  element :updated, type: Time
@@ -5,8 +5,6 @@ module Xommelier
5
5
  class Feed < Xml::Element
6
6
  include LinksExtension
7
7
 
8
- root
9
-
10
8
  element :id, unique: true
11
9
  element :title
12
10
  element :updated, type: Time
@@ -0,0 +1,24 @@
1
+ require 'xommelier'
2
+
3
+ module Xommelier
4
+ module Common
5
+ # A date-time displayed in RFC 822 format.
6
+ class Time822 < Time
7
+ def self.from_xommelier(value)
8
+ case value
9
+ when String
10
+ value = rfc2822(value) rescue parse(value)
11
+ at(value)
12
+ when Time, Date, DateTime
13
+ at(value.to_time)
14
+ else
15
+ raise TypeError, "Invalid value #{value.inspect} for Time822"
16
+ end
17
+ end
18
+
19
+ def to_xommelier
20
+ utc.rfc822
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,122 @@
1
+ require 'xommelier'
2
+ require 'xommelier/common'
3
+
4
+ module Xommelier
5
+ module OPML
6
+ include Xommelier::Xml
7
+
8
+ # @!group Simple Types
9
+
10
+ class Category < Array
11
+ def self.from_xommelier(value)
12
+ new(value.split('/'))
13
+ end
14
+
15
+ def category?
16
+ [0] == nil
17
+ end
18
+
19
+ def tag?
20
+ !category?
21
+ end
22
+
23
+ def to_xommelier
24
+ join('/')
25
+ end
26
+ end
27
+
28
+ class CategoryArray < Array
29
+ def self.from_xommelier(value)
30
+ new(value.split(',').map { |category| Category.from_xommelier(category) })
31
+ end
32
+
33
+ def to_xommelier
34
+ map { |category| category.to_xommelier }.join(',')
35
+ end
36
+ end
37
+
38
+ # @!group Complex Types
39
+
40
+ class Element < Xml::Element
41
+ def self.element(name, options = {})
42
+ options[:as] ||= name.to_s.camelize(:lower)
43
+ super(name, options)
44
+ end
45
+
46
+ def self.attribute(name, options = {})
47
+ options[:as] ||= name.to_s.camelize(:lower)
48
+ super(name, options)
49
+ end
50
+ end
51
+
52
+ class Head < Element
53
+ may do
54
+ element :title
55
+ element :date_created, type: Common::Time822
56
+ element :date_modified, type: Common::Time822
57
+ element :owner_name
58
+ element :owner_email
59
+ element :owner_id
60
+ element :docs
61
+ #element :expansionState
62
+ #element :vertScrollState
63
+ #element :windowTop
64
+ #element :windowLeft
65
+ #element :windowBottom
66
+ #element :windowRight
67
+ end
68
+ end
69
+
70
+
71
+ class Outline < Element
72
+ attribute :text
73
+
74
+ may do
75
+ # Common
76
+ attribute :type
77
+ attribute :is_comment, type: Boolean, default: false
78
+ attribute :is_breakpoint, type: Boolean, default: false
79
+ attribute :created, type: Common::Time822
80
+ attribute :category, type: CategoryArray
81
+ # Subscriptions
82
+ attribute :xml_url
83
+ attribute :html_url
84
+ attribute :description
85
+ attribute :language
86
+ attribute :version
87
+ # Links
88
+ attribute :url
89
+ end
90
+
91
+ any do
92
+ element :outline, type: Outline
93
+ end
94
+
95
+ def each_outline(&block)
96
+ block.call(self)
97
+ outlines.each do |outline|
98
+ outline.each_outline(&block)
99
+ end
100
+ end
101
+ end
102
+
103
+ class Body < Element
104
+ many do
105
+ element :outline, type: Outline
106
+ end
107
+
108
+ def each_outline(&block)
109
+ outlines.each do |outline|
110
+ outline.each_outline(&block)
111
+ end
112
+ end
113
+ end
114
+
115
+ class Opml < Element
116
+ attribute :version, default: '2.0'
117
+
118
+ element :head, type: Head
119
+ element :body, type: Body
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,237 @@
1
+ require 'xommelier'
2
+ require 'xommelier/common'
3
+
4
+ module Xommelier
5
+ # http://www.rssboard.org/rss-specification
6
+ module RSS
7
+ include Xommelier::Xml
8
+
9
+ # TODO RSS Email simple type if needed
10
+ # class EmailAddress < String
11
+ # end
12
+
13
+ class Element < Xml::Element
14
+ def self.element(name, options = {})
15
+ options[:as] ||= name.to_s.camelcase(:lower)
16
+ super
17
+ end
18
+
19
+ def self.attribute(name, options = {})
20
+ options[:as] ||= name.to_s.camelcase(:lower)
21
+ super
22
+ end
23
+ end
24
+
25
+ class Category < Element
26
+ attribute :domain
27
+ text
28
+ end
29
+
30
+ # Specifies a web service that supports the rssCloud interface which can be implemented
31
+ # in HTTP-POST, XML-RPC or SOAP 1.1.
32
+ # Its purpose is to allow processes to register with a cloud to be notified of updates to the channel,
33
+ # implementing a lightweight publish-subscribe protocol for RSS feeds.
34
+ class Cloud < Element
35
+ attribute :domain
36
+ attribute :port, type: Integer
37
+ attribute :path
38
+ attribute :register_procedure
39
+ attribute :protocol # in: %w(xml-rpc http-post soap)
40
+ end
41
+
42
+ class Image < Element
43
+ # The URL of the image file.
44
+ element :url, type: Uri
45
+
46
+ # Describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
47
+ element :title
48
+
49
+ # 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 <link> should have the same value as the channel's <title> and <link>.
50
+ element :link, type: Uri
51
+
52
+ may do
53
+ # The width of the image in pixels.
54
+ element :width, type: Integer, default: 88#, max: 144
55
+
56
+ # The height of the image in pixels.
57
+ element :height, type: Integer, default: 31#, max: 400
58
+
59
+ # Text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.
60
+ element :description
61
+ end
62
+ end
63
+
64
+ # NOTE Ignore it. Nothing useful. Really
65
+ class TextInput < Element
66
+ end
67
+
68
+ class SkipHoursList < Element
69
+ any do
70
+ # A time in GMT when aggregators should not request the channel data.
71
+ # The hour beginning at midnight is hour zero.
72
+ element :hour, type: Integer#, in: 0..23
73
+ end
74
+ end
75
+
76
+ class SkipDaysList < Element
77
+ any do
78
+ # A day when aggregators should not request the channel data.
79
+ element :day# in: %w(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)
80
+ end
81
+ end
82
+
83
+ class Enclosure < Element
84
+ # URL where the enclosure is located
85
+ attribute :url, type: Uri
86
+
87
+ # Size in bytes
88
+ attribute :length, type: Integer
89
+
90
+ # MIME media-type of the enclosure
91
+ attribute :type
92
+
93
+ text
94
+ end
95
+
96
+ class Guid < Element
97
+ attribute :permalink, as: 'isPermaLink', type: Boolean, count: :may
98
+
99
+ text
100
+ end
101
+
102
+ # TODO RSS Source complex type
103
+ class Source < Element
104
+ attribute :url, type: Uri
105
+
106
+ text
107
+ end
108
+
109
+ # An item may represent a "story" -- much like a story in a newspaper or magazine;
110
+ # if so its description is a synopsis of the story, and the link points to the full story.
111
+ # An item may also be complete in itself,
112
+ # if so, the description contains the text (entity-encoded HTML is allowed),
113
+ # and the link and title may be omitted.
114
+ class Item < Element
115
+ # guid or permalink URL for this entry
116
+ element :guid, type: Guid
117
+
118
+ # The title of the item.
119
+ element :title
120
+
121
+ # The item synopsis.
122
+ element :description
123
+
124
+ # The URL of the item.
125
+ element :link, type: Uri
126
+
127
+ # Email address of the author of the item.
128
+ element :author#, type: EmailAddress
129
+
130
+ # Includes the item in one or more categories.
131
+ element :category, type: Category, count: :any
132
+
133
+ # URL of a page for comments relating to the item.
134
+ element :comments, type: Uri, count: :may
135
+
136
+ # Describes a media object that is attached to the item.
137
+ element :enclosure, type: Enclosure, count: :any
138
+
139
+ # Indicates when the item was published.
140
+ element :pub_date, type: Common::Time822
141
+
142
+ # The RSS channel that the item came from.
143
+ element :source, type: Source
144
+ end
145
+
146
+ class Channel < Element
147
+ # The name of the channel. It's how people refer to your service.
148
+ # If you have an HTML website that contains the same information as your RSS file,
149
+ # the title of your channel should be the same as the title of your website.
150
+ element :title
151
+
152
+ # The URL to the HTML website corresponding to the channel.
153
+ element :link, type: Uri #, type: XS::AnyUri
154
+
155
+ # Phrase or sentence describing the channel.
156
+ element :description
157
+
158
+ may do
159
+ # The language the channel is written in. This allows aggregators to group all Italian language sites,
160
+ # for example, on a single page.
161
+ element :language #, type: XS::Language
162
+
163
+ # Copyright notice for content in the channel.
164
+ element :copyright
165
+
166
+ # Email address for person responsible for editorial content.
167
+ element :managing_editor#, type: EmailAddress
168
+
169
+ # Email address for person responsible for technical issues relating to channel.
170
+ element :web_master#, type: EmailAddress
171
+
172
+ # The publication date for the content in the channel.
173
+ # All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception
174
+ # that the year may be expressed with two characters or four characters (four preferred).
175
+ element :pub_date, type: Common::Time822
176
+
177
+ # The last time the content of the channel changed.
178
+ element :last_build_date, type: Common::Time822
179
+ end
180
+
181
+ # Specify one or more categories that the channel belongs to.
182
+ element :category, type: Category, count: :any
183
+
184
+ may do
185
+ # A string indicating the program used to generate the channel.
186
+ element :generator
187
+
188
+ # A URL that points to the documentation for the format used in the RSS file.
189
+ # It's probably a pointer to http://www.rssboard.org/rss-specification.
190
+ # It's for people who might stumble across an RSS file on a Web server 25 years from now and wonder what it is.
191
+ element :docs
192
+
193
+ # Allows processes to register with a cloud to be notified of updates to the channel,
194
+ # implementing a lightweight publish-subscribe protocol for RSS feeds.
195
+ element :cloud, type: Cloud
196
+
197
+ # time to live. It's a number of minutes that indicates how long a channel can be cached
198
+ # before refreshing from the source.
199
+ element :ttl, type: Integer
200
+
201
+ # Specifies a GIF, JPEG or PNG image that can be displayed with the channel.
202
+ element :image, type: Image
203
+
204
+ # The PICS rating for the channel.
205
+ element :rating
206
+
207
+ # Specifies a text input box that can be displayed with the channel.
208
+ element :text_input, type: TextInput
209
+
210
+ # A hint for aggregators telling them which hours they can skip.
211
+ element :skip_hours, type: SkipHoursList
212
+
213
+ # A hint for aggregators telling them which days they can skip.
214
+ element :skip_days, type: SkipDaysList
215
+ end
216
+
217
+ many do
218
+ element :item, type: Item
219
+ end
220
+ end
221
+
222
+ class Rss < Element
223
+ attribute :version, default: '2.0', required: true
224
+
225
+ element :channel, type: Channel, default: {}
226
+
227
+ #noinspection RubyResolve
228
+ def method_missing(method_name, *args)
229
+ if channel.respond_to?(method_name) then
230
+ channel.send(method_name, *args)
231
+ else
232
+ super
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,500 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ XML Schema for RSS v2.0
4
+ Copyright (C) 2003-2008 Jorgen Thelin
5
+
6
+ Microsoft Public License (Ms-PL)
7
+
8
+ This license governs use of the accompanying software.
9
+ If you use the software, you accept this license.
10
+ If you do not accept the license, do not use the software.
11
+
12
+ 1. Definitions
13
+
14
+ The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
15
+
16
+ A "contribution" is the original software, or any additions or changes to the software.
17
+
18
+ A "contributor" is any person that distributes its contribution under this license.
19
+
20
+ "Licensed patents" are a contributor's patent claims that read directly on its contribution.
21
+
22
+ 2. Grant of Rights
23
+
24
+ (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
25
+
26
+ (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
27
+
28
+ 3. Conditions and Limitations
29
+
30
+ (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
31
+
32
+ (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
33
+
34
+ (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
35
+
36
+ (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
37
+
38
+ (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
39
+
40
+ -->
41
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
42
+ elementFormDefault="unqualified"
43
+ version="2.0.2.16">
44
+ <xs:annotation>
45
+ <xs:documentation>XML Schema for RSS v2.0 feed files.</xs:documentation>
46
+ <xs:documentation>Project home: http://www.codeplex.com/rss2schema/ </xs:documentation>
47
+ <xs:documentation>Based on the RSS 2.0 specification document at http://cyber.law.harvard.edu/rss/rss.html </xs:documentation>
48
+ <xs:documentation>Author: Jorgen Thelin</xs:documentation>
49
+ <xs:documentation>Revision: 16</xs:documentation>
50
+ <xs:documentation>Date: 01-Nov-2008</xs:documentation>
51
+ <xs:documentation>Feedback to: http://www.codeplex.com/rss2schema/WorkItem/List.aspx </xs:documentation>
52
+ </xs:annotation>
53
+ <xs:element name="rss">
54
+ <xs:complexType>
55
+ <xs:sequence>
56
+ <xs:element name="channel" type="RssChannel"/>
57
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
58
+ </xs:sequence>
59
+ <xs:attribute name="version" type="xs:decimal" use="required" fixed="2.0"/>
60
+ <xs:anyAttribute namespace="##any"/>
61
+ </xs:complexType>
62
+ </xs:element>
63
+ <xs:complexType name="RssItem">
64
+ <xs:annotation>
65
+ <xs:documentation>An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed), and the link and title may be omitted.</xs:documentation>
66
+ </xs:annotation>
67
+ <xs:sequence>
68
+ <xs:choice maxOccurs="unbounded">
69
+ <xs:element name="title" type="xs:string" minOccurs="0">
70
+ <xs:annotation>
71
+ <xs:documentation>The title of the item.</xs:documentation>
72
+ </xs:annotation>
73
+ </xs:element>
74
+ <xs:element name="description" type="xs:string" minOccurs="0">
75
+ <xs:annotation>
76
+ <xs:documentation>The item synopsis.</xs:documentation>
77
+ </xs:annotation>
78
+ </xs:element>
79
+ <xs:element name="link" type="xs:anyURI" minOccurs="0">
80
+ <xs:annotation>
81
+ <xs:documentation>The URL of the item.</xs:documentation>
82
+ </xs:annotation>
83
+ </xs:element>
84
+ <xs:element name="author" type="EmailAddress" minOccurs="0">
85
+ <xs:annotation>
86
+ <xs:documentation>Email address of the author of the item.</xs:documentation>
87
+ </xs:annotation>
88
+ </xs:element>
89
+ <xs:element name="category" type="Category" minOccurs="0">
90
+ <xs:annotation>
91
+ <xs:documentation>Includes the item in one or more categories. </xs:documentation>
92
+ </xs:annotation>
93
+ </xs:element>
94
+ <xs:element name="comments" type="xs:anyURI" minOccurs="0">
95
+ <xs:annotation>
96
+ <xs:documentation>URL of a page for comments relating to the item.</xs:documentation>
97
+ </xs:annotation>
98
+ </xs:element>
99
+ <xs:element name="enclosure" type="Enclosure" minOccurs="0">
100
+ <xs:annotation>
101
+ <xs:documentation>Describes a media object that is attached to the item.</xs:documentation>
102
+ </xs:annotation>
103
+ </xs:element>
104
+ <xs:element name="guid" type="Guid" minOccurs="0">
105
+ <xs:annotation>
106
+ <xs:documentation>guid or permalink URL for this entry</xs:documentation>
107
+ </xs:annotation>
108
+ </xs:element>
109
+ <xs:element name="pubDate" type="Rfc822FormatDate" minOccurs="0">
110
+ <xs:annotation>
111
+ <xs:documentation>Indicates when the item was published.</xs:documentation>
112
+ </xs:annotation>
113
+ </xs:element>
114
+ <xs:element name="source" type="Source" minOccurs="0">
115
+ <xs:annotation>
116
+ <xs:documentation>The RSS channel that the item came from.</xs:documentation>
117
+ </xs:annotation>
118
+ </xs:element>
119
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
120
+ <xs:annotation>
121
+ <xs:documentation>Extensibility element.</xs:documentation>
122
+ </xs:annotation>
123
+ </xs:any>
124
+ </xs:choice>
125
+ </xs:sequence>
126
+ <xs:anyAttribute namespace="##any"/>
127
+ </xs:complexType>
128
+ <xs:complexType name="RssChannel">
129
+ <xs:sequence>
130
+ <xs:choice maxOccurs="unbounded">
131
+ <xs:element name="title" type="xs:string">
132
+ <xs:annotation>
133
+ <xs:documentation>The name of the channel. It's how people refer to your service. If you have an HTML website that contains the same information as your RSS file, the title of your channel should be the same as the title of your website.</xs:documentation>
134
+ </xs:annotation>
135
+ </xs:element>
136
+ <xs:element name="link" type="xs:anyURI">
137
+ <xs:annotation>
138
+ <xs:documentation>The URL to the HTML website corresponding to the channel.</xs:documentation>
139
+ </xs:annotation>
140
+ </xs:element>
141
+ <xs:element name="description" type="xs:string">
142
+ <xs:annotation>
143
+ <xs:documentation>Phrase or sentence describing the channel.</xs:documentation>
144
+ </xs:annotation>
145
+ </xs:element>
146
+ <xs:element name="language" type="xs:language" minOccurs="0">
147
+ <xs:annotation>
148
+ <xs:documentation>The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. A list of allowable values for this element, as provided by Netscape, is here. You may also use values defined by the W3C.</xs:documentation>
149
+ </xs:annotation>
150
+ </xs:element>
151
+ <xs:element name="copyright" type="xs:string" minOccurs="0">
152
+ <xs:annotation>
153
+ <xs:documentation>Copyright notice for content in the channel.</xs:documentation>
154
+ </xs:annotation>
155
+ </xs:element>
156
+ <xs:element name="managingEditor" type="EmailAddress" minOccurs="0">
157
+ <xs:annotation>
158
+ <xs:documentation>Email address for person responsible for editorial content.</xs:documentation>
159
+ </xs:annotation>
160
+ </xs:element>
161
+ <xs:element name="webMaster" type="EmailAddress" minOccurs="0">
162
+ <xs:annotation>
163
+ <xs:documentation>Email address for person responsible for technical issues relating to channel.</xs:documentation>
164
+ </xs:annotation>
165
+ </xs:element>
166
+ <xs:element name="pubDate" type="Rfc822FormatDate" minOccurs="0">
167
+ <xs:annotation>
168
+ <xs:documentation>The publication date for the content in the channel. All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).</xs:documentation>
169
+ </xs:annotation>
170
+ </xs:element>
171
+ <xs:element name="lastBuildDate" type="Rfc822FormatDate" minOccurs="0">
172
+ <xs:annotation>
173
+ <xs:documentation>The last time the content of the channel changed.</xs:documentation>
174
+ </xs:annotation>
175
+ </xs:element>
176
+ <xs:element name="category" type="Category" minOccurs="0">
177
+ <xs:annotation>
178
+ <xs:documentation>Specify one or more categories that the channel belongs to.</xs:documentation>
179
+ </xs:annotation>
180
+ </xs:element>
181
+ <xs:element name="generator" type="xs:string" minOccurs="0">
182
+ <xs:annotation>
183
+ <xs:documentation>A string indicating the program used to generate the channel.</xs:documentation>
184
+ </xs:annotation>
185
+ </xs:element>
186
+ <xs:element name="docs" type="xs:anyURI" minOccurs="0">
187
+ <xs:annotation>
188
+ <xs:documentation>A URL that points to the documentation for the format used in the RSS file. It's probably a pointer to this page. It's for people who might stumble across an RSS file on a Web server 25 years from now and wonder what it is.</xs:documentation>
189
+ </xs:annotation>
190
+ </xs:element>
191
+ <xs:element name="cloud" type="Cloud" minOccurs="0">
192
+ <xs:annotation>
193
+ <xs:documentation>Allows processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds.</xs:documentation>
194
+ </xs:annotation>
195
+ </xs:element>
196
+ <xs:element name="ttl" type="xs:nonNegativeInteger" minOccurs="0">
197
+ <xs:annotation>
198
+ <xs:documentation>ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.</xs:documentation>
199
+ </xs:annotation>
200
+ </xs:element>
201
+ <xs:element name="image" type="Image" minOccurs="0">
202
+ <xs:annotation>
203
+ <xs:documentation>Specifies a GIF, JPEG or PNG image that can be displayed with the channel.</xs:documentation>
204
+ </xs:annotation>
205
+ </xs:element>
206
+ <xs:element name="rating" type="xs:string" minOccurs="0">
207
+ <xs:annotation>
208
+ <xs:documentation>The PICS rating for the channel.</xs:documentation>
209
+ </xs:annotation>
210
+ </xs:element>
211
+ <xs:element name="textInput" type="TextInput" minOccurs="0">
212
+ <xs:annotation>
213
+ <xs:documentation>Specifies a text input box that can be displayed with the channel.</xs:documentation>
214
+ </xs:annotation>
215
+ </xs:element>
216
+ <xs:element name="skipHours" type="SkipHoursList" minOccurs="0">
217
+ <xs:annotation>
218
+ <xs:documentation>A hint for aggregators telling them which hours they can skip.</xs:documentation>
219
+ </xs:annotation>
220
+ </xs:element>
221
+ <xs:element name="skipDays" type="SkipDaysList" minOccurs="0">
222
+ <xs:annotation>
223
+ <xs:documentation>A hint for aggregators telling them which days they can skip.</xs:documentation>
224
+ </xs:annotation>
225
+ </xs:element>
226
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
227
+ <xs:annotation>
228
+ <xs:documentation>Extensibility element.</xs:documentation>
229
+ </xs:annotation>
230
+ </xs:any>
231
+ </xs:choice>
232
+ <xs:element name="item" type="RssItem" minOccurs="1" maxOccurs="unbounded">
233
+ <!--
234
+ HACK: According to the RSS 2.0 spec, it should strictly be possible to have zero item elements,
235
+ but this makes the schema non-deterministic with regard to extensibility elements
236
+ so for the moment we undid bug-fix 10231 and set minOccurs=1 to work around this problem.
237
+ -->
238
+ </xs:element>
239
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
240
+ <xs:annotation>
241
+ <xs:documentation>Extensibility element.</xs:documentation>
242
+ </xs:annotation>
243
+ </xs:any>
244
+ </xs:sequence>
245
+ <xs:anyAttribute namespace="##any"/>
246
+ </xs:complexType>
247
+ <xs:simpleType name="SkipHour">
248
+ <xs:annotation>
249
+ <xs:documentation>A time in GMT when aggregators should not request the channel data. The hour beginning at midnight is hour zero.</xs:documentation>
250
+ </xs:annotation>
251
+ <xs:restriction base="xs:nonNegativeInteger">
252
+ <xs:minInclusive value="0"/>
253
+ <xs:maxInclusive value="23"/>
254
+ </xs:restriction>
255
+ </xs:simpleType>
256
+ <xs:complexType name="SkipHoursList">
257
+ <xs:sequence>
258
+ <xs:element name="hour" type="SkipHour" minOccurs="0" maxOccurs="24"/>
259
+ </xs:sequence>
260
+ </xs:complexType>
261
+ <xs:simpleType name="SkipDay">
262
+ <xs:annotation>
263
+ <xs:documentation>A day when aggregators should not request the channel data.</xs:documentation>
264
+ </xs:annotation>
265
+ <xs:restriction base="xs:string">
266
+ <xs:enumeration value="Monday"/>
267
+ <xs:enumeration value="Tuesday"/>
268
+ <xs:enumeration value="Wednesday"/>
269
+ <xs:enumeration value="Thursday"/>
270
+ <xs:enumeration value="Friday"/>
271
+ <xs:enumeration value="Saturday"/>
272
+ <xs:enumeration value="Sunday"/>
273
+ </xs:restriction>
274
+ </xs:simpleType>
275
+ <xs:complexType name="SkipDaysList">
276
+ <xs:sequence>
277
+ <xs:element name="day" type="SkipDay" minOccurs="0" maxOccurs="7">
278
+ <xs:annotation>
279
+ <xs:documentation>A time in GMT, when aggregators should not request the channel data. The hour beginning at midnight is hour zero.</xs:documentation>
280
+ </xs:annotation>
281
+ </xs:element>
282
+ </xs:sequence>
283
+ </xs:complexType>
284
+ <xs:complexType name="Category">
285
+ <xs:simpleContent>
286
+ <xs:extension base="xs:string">
287
+ <xs:attribute name="domain" type="xs:string" use="optional"/>
288
+ </xs:extension>
289
+ </xs:simpleContent>
290
+ </xs:complexType>
291
+ <xs:complexType name="Image">
292
+ <xs:all>
293
+ <xs:element name="url" type="xs:anyURI">
294
+ <xs:annotation>
295
+ <xs:documentation>The URL of the image file.</xs:documentation>
296
+ </xs:annotation>
297
+ </xs:element>
298
+ <xs:element name="title" type="xs:string">
299
+ <xs:annotation>
300
+ <xs:documentation>Describes the image, it's used in the ALT attribute of the HTML &lt;img&gt; tag when the channel is rendered in HTML.</xs:documentation>
301
+ </xs:annotation>
302
+ </xs:element>
303
+ <xs:element name="link" type="xs:anyURI">
304
+ <xs:annotation>
305
+ <xs:documentation>The URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image &lt;title&gt; and &lt;link&gt; should have the same value as the channel's &lt;title&gt; and &lt;link&gt;. </xs:documentation>
306
+ </xs:annotation>
307
+ </xs:element>
308
+ <xs:element name="width" type="ImageWidth" default="88" minOccurs="0">
309
+ <xs:annotation>
310
+ <xs:documentation>The width of the image in pixels.</xs:documentation>
311
+ </xs:annotation>
312
+ </xs:element>
313
+ <xs:element name="height" type="ImageHeight" default="31" minOccurs="0">
314
+ <xs:annotation>
315
+ <xs:documentation>The height of the image in pixels.</xs:documentation>
316
+ </xs:annotation>
317
+ </xs:element>
318
+ <xs:element name="description" type="xs:string" minOccurs="0">
319
+ <xs:annotation>
320
+ <xs:documentation>Text that is included in the TITLE attribute of the link formed around the image in the HTML rendering.</xs:documentation>
321
+ </xs:annotation>
322
+ </xs:element>
323
+ </xs:all>
324
+ </xs:complexType>
325
+ <xs:simpleType name="ImageHeight">
326
+ <xs:annotation>
327
+ <xs:documentation>The height of the image in pixels.</xs:documentation>
328
+ </xs:annotation>
329
+ <xs:restriction base="xs:positiveInteger">
330
+ <xs:maxInclusive value="400"/>
331
+ </xs:restriction>
332
+ </xs:simpleType>
333
+ <xs:simpleType name="ImageWidth">
334
+ <xs:annotation>
335
+ <xs:documentation>The width of the image in pixels.</xs:documentation>
336
+ </xs:annotation>
337
+ <xs:restriction base="xs:positiveInteger">
338
+ <xs:maxInclusive value="144"/>
339
+ </xs:restriction>
340
+ </xs:simpleType>
341
+ <xs:complexType name="Cloud">
342
+ <xs:annotation>
343
+ <xs:documentation>Specifies a web service that supports the rssCloud interface which can be implemented in HTTP-POST, XML-RPC or SOAP 1.1. Its purpose is to allow processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds.</xs:documentation>
344
+ </xs:annotation>
345
+ <xs:attribute name="domain" type="xs:string" use="required"/>
346
+ <xs:attribute name="port" type="xs:positiveInteger" use="required"/>
347
+ <xs:attribute name="path" type="xs:string" use="required"/>
348
+ <xs:attribute name="registerProcedure" type="xs:string" use="required"/>
349
+ <xs:attribute name="protocol" type="CloudProtocol" use="required"/>
350
+ </xs:complexType>
351
+ <xs:simpleType name="CloudProtocol">
352
+ <xs:restriction base="xs:string">
353
+ <xs:enumeration value="xml-rpc"/>
354
+ <xs:enumeration value="http-post"/>
355
+ <xs:enumeration value="soap"/>
356
+ </xs:restriction>
357
+ </xs:simpleType>
358
+ <xs:complexType name="TextInput">
359
+ <xs:annotation>
360
+ <xs:documentation>The purpose of this element is something of a mystery! You can use it to specify a search engine box. Or to allow a reader to provide feedback. Most aggregators ignore it.</xs:documentation>
361
+ </xs:annotation>
362
+ <xs:all>
363
+ <xs:element name="title" type="xs:string">
364
+ <xs:annotation>
365
+ <xs:documentation>The label of the Submit button in the text input area.</xs:documentation>
366
+ </xs:annotation>
367
+ </xs:element>
368
+ <xs:element name="description" type="xs:string">
369
+ <xs:annotation>
370
+ <xs:documentation>Explains the text input area.</xs:documentation>
371
+ </xs:annotation>
372
+ </xs:element>
373
+ <xs:element name="name" type="xs:string">
374
+ <xs:annotation>
375
+ <xs:documentation>The name of the text object in the text input area.</xs:documentation>
376
+ </xs:annotation>
377
+ </xs:element>
378
+ <xs:element name="link" type="xs:anyURI">
379
+ <xs:annotation>
380
+ <xs:documentation>The URL of the CGI script that processes text input requests.</xs:documentation>
381
+ </xs:annotation>
382
+ </xs:element>
383
+ </xs:all>
384
+ </xs:complexType>
385
+ <xs:simpleType name="EmailAddress">
386
+ <xs:annotation>
387
+ <xs:documentation>Using the regexp definiton of E-Mail Address by Lucadean from the .NET RegExp Pattern Repository at http://www.3leaf.com/default/NetRegExpRepository.aspx </xs:documentation>
388
+ </xs:annotation>
389
+ <xs:restriction base="xs:string">
390
+ <xs:pattern value="([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])"/>
391
+ </xs:restriction>
392
+ </xs:simpleType>
393
+ <xs:simpleType name="Rfc822FormatDate">
394
+ <xs:annotation>
395
+ <xs:documentation>A date-time displayed in RFC-822 format.</xs:documentation>
396
+ <xs:documentation>Using the regexp definiton of rfc-822 date by Sam Ruby at http://www.intertwingly.net/blog/1360.html </xs:documentation>
397
+ </xs:annotation>
398
+ <xs:restriction base="xs:string">
399
+ <xs:pattern value="(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), *)?\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+\-]?\d\d\d\d)|(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)"/>
400
+ </xs:restriction>
401
+ </xs:simpleType>
402
+ <xs:complexType name="Source">
403
+ <xs:simpleContent>
404
+ <xs:extension base="xs:string">
405
+ <xs:attribute name="url" type="xs:anyURI"/>
406
+ </xs:extension>
407
+ </xs:simpleContent>
408
+ </xs:complexType>
409
+ <xs:complexType name="Enclosure">
410
+ <xs:simpleContent>
411
+ <xs:extension base="xs:string">
412
+ <xs:attribute name="url" type="xs:anyURI" use="required">
413
+ <xs:annotation>
414
+ <xs:documentation>URL where the enclosure is located</xs:documentation>
415
+ </xs:annotation>
416
+ </xs:attribute>
417
+ <xs:attribute name="length" type="xs:nonNegativeInteger" use="required">
418
+ <xs:annotation>
419
+ <xs:documentation>Size in bytes</xs:documentation>
420
+ </xs:annotation>
421
+ </xs:attribute>
422
+ <xs:attribute name="type" type="xs:string" use="required">
423
+ <xs:annotation>
424
+ <xs:documentation>MIME media-type of the enclosure</xs:documentation>
425
+ </xs:annotation>
426
+ </xs:attribute>
427
+ </xs:extension>
428
+ </xs:simpleContent>
429
+ </xs:complexType>
430
+ <xs:complexType name="Guid">
431
+ <xs:simpleContent>
432
+ <xs:extension base="xs:string">
433
+ <xs:attribute name="isPermaLink" type="xs:boolean" use="optional" default="true"/>
434
+ </xs:extension>
435
+ </xs:simpleContent>
436
+ </xs:complexType>
437
+
438
+ <!--
439
+ TODO:
440
+ - Need to add regexp pattern for MIME media-type value of tEnclosure/type
441
+ - Need to add regexp pattern for checking contents of guid is a URL when isPermaLink=true"
442
+ - Need to add some form of constraint to check on an item that one, or other, or both of title and description are present.
443
+ However, I'm not sure it is possible to represent these constraints in XML Schema language alone.
444
+ - Need some way to enforce cardinality constraints preventing repeated elements in channels or items
445
+ - Unfortunately the bug-fix for issue 10231 made this schema non-deterministic with respect to extensibitity elements.
446
+ We can't tell whether an extension element in tRssChannel is within the choice or after the item elements.
447
+ Need to reconsider the solution to bug-fix 10231.
448
+ -->
449
+
450
+ <!--
451
+ Change Log:
452
+ Date Revision Description
453
+ 31-Mar-2003 1 Initial version released for comment
454
+ 31-Mar-2003 2 Changes based on feedback from Gudge:
455
+ - Remove targetNamespace="" and use elemenfFormDefault="unqualified" instead
456
+ - Use namespace="##other" on <any>'s to create a more deterministic data model.
457
+ - Added missing xs:documentation inside xs:annotation at the schema level.
458
+ - Use xs:language for ISO Language Codes in <language> element.
459
+ - Change guid to a single declaration. This loses some of the checking of the
460
+ URL when the contents of the guid is a permaLink, so we will need to add
461
+ that back in with a regexp pattern.
462
+ 14-Apr-2003 3 Changes to solve some element ordering problems.
463
+ - Use xs:all in place of xs:sequence to support flexible ordering of elements.
464
+ Although the ordering constraints for elements is not clear from the
465
+ original specification, the custom and practice seems to be that
466
+ element ordering is freeform.
467
+ - Use elemenfFormDefault="qualified" for explicit intent.
468
+ 15-Apr-2003 4 Changes to solve some element ordering problems.
469
+ - Use xs:choice in place of xs:all as previous usage of <all> was invalid.
470
+ This creates the problem that unsufficient constraints can be applied
471
+ by the schema - for example, it can't prevent two title elements for an item.
472
+ - Use elemenfFormDefault="unqualified" for to get the correct behavious
473
+ when importing and combining schemas.
474
+ 15-Apr-2003 5 Putting the extensibility element inside the repeating choice solves
475
+ all problems with element ordering.
476
+ 15-Apr-2003 6 - skipHours and skipDays should contain a nested list of values,
477
+ not just a single value.
478
+ - Added version attribute to schema definition.
479
+ - Corrected type of the cloud element
480
+ 25-Apr-2003 7 - Add regexp for RFC-822 date suggested by Sam Ruby
481
+ - I had to leave the base type of the tRfc822FormatDate type
482
+ as xs:string due to the problems with using
483
+ a pattern with xs:dateTime described at
484
+ http://www.thearchitect.co.uk/weblog/archives/2003/04/000142.html
485
+ 19-Jun-2003 8 - Fixed a bug the Oxygen XML Editor spotted in the regexp for RFC-822 dates
486
+ 23-Jun-2003 9 - Added legal boilerplate license text for LGPL.
487
+ - Minor formatting changes.
488
+ 24-Jun-2003 10 - Missing types for item/title and item/description - Spotted by Andreas Schwotzer.
489
+ 01-Jan-2008 11 - Copy made available under the Microsoft Public License (MS-PL).
490
+ 25-May-2008 12 - Bug fix 10231 from Ken Gruven - channel can contain zero or more items.
491
+ 06-Sep-2008 13 - Fixed tab-space whitespace issues. Now always use spaces.
492
+ - Undid the fix for bug-fix 10231 since it made the schema non-deterministic
493
+ with respect to extensibility eleemnts in tRssChannel - need to reconsider the fix.
494
+ 08-Sep-2008 14 - Removed 't' prefixes from type names to improve class names
495
+ that get code-generated from the schema.
496
+ 22-Sep-2008 15 - Move type def for rss element in-line for improved compativility with Java 1.6 tools.
497
+ 01-Nov-2008 16 - Added the missing rating element from the spec to RssChannel.
498
+ -->
499
+
500
+ </xs:schema>