public
Description: (Unofficial) RELAX NG schema to specify the construction and meaning of OPML 1.0 and 2.0 documents.
Homepage:
Clone URL: git://github.com/tommorris/opml-schema.git
opml-schema / schema.rng
100644 304 lines (303 sloc) 12.424 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <element name="opml">
      <optional>
        <attribute name="transformation" ns="http://www.w3.org/2003/g/data-view#">
          <text />
        </attribute>
      </optional>
      <choice>
        <group>
          <attribute name="version">
<choice>
             <value type="string">1.0</value>
             <value type="string">1.1</value>
</choice>
          </attribute>
          <ref name="head"/>
          <element name="body">
            <ref name="onode1"/>
          </element>
        </group>
        <group>
          <attribute name="version">
            <value type="string">2.0</value>
          </attribute>
          <ref name="head"/>
          <element name="body">
            <oneOrMore>
              <ref name="onode2"/>
            </oneOrMore>
          </element>
        </group>
      </choice>
    </element>
  </start>
  <define name="head">
    <element name="head">
      <interleave>
        <optional>
          <element name="title">
            <a:documentation xml:lang="en">The title of the document.</a:documentation>
            <data type="string"/>
          </element>
        </optional>
        <optional>
          <element name="dateCreated">
            <a:documentation xml:lang="en">A date-time, indicating when the document was created.</a:documentation>
            <ref name="rfc_822_opml_rx" />
          </element>
        </optional>
        <optional>
          <element name="dateModified">
            <a:documentation xml:lang="en">A date-time, indicating when the document was last modified.</a:documentation>
            <ref name="rfc_822_opml_rx" />
          </element>
        </optional>
        <optional>
          <element name="ownerName">
            <a:documentation xml:lang="en">The owner of the document.</a:documentation>
            <data type="string" />
          </element>
        </optional>
        <optional>
          <element name="ownerEmail">
            <a:documentation xml:lang="en">The email address of the owner of the document.</a:documentation>
            <data type="string" />
          </element>
        </optional>
        <optional>
          <element name="ownerId">
            <a:documentation xml:lang="en">The HTTP address of a web page that contains a form that allows a human reader to communicate with the author of the document via email or other means. The linked page may contain link elements pointing to other documents containing information about the owner.</a:documentation>
            <data type="anyURI" />
          </element>
        </optional>
        <optional>
          <element name="docs">
            <a:documentation xml:lang="en">The HTTP address of documentation for the format used in the OPML file. It's probably a pointer to this page for people who might stumble across the file on a web server 25 years from now and wonder what it is.</a:documentation>
            <data type="anyURI" />
          </element>
        </optional>
        <optional>
          <element name="expansionState">
            <a:documentation xml:lang="en">A comma-separated list of line numbers that are expanded. The line numbers in the list tell you which headlines to expand. The order is important. For each element in the list, X, starting at the first summit, navigate flatdown X times and expand. Repeat for each element in the list.</a:documentation>
            <choice>
              <ref name="commasep" />
              <empty />
            </choice>
          </element>
        </optional>
        <optional>
          <element name="vertScrollState">
            <a:documentation xml:lang="en">A number, saying which line of the outline is displayed on the top line of the window. This number is calculated with the expansion state already applied.</a:documentation>
            <data type="int" />
          </element>
        </optional>
        <optional>
          <element name="windowTop">
            <a:documentation xml:lang="en">The pixel location of the top edge of the window.</a:documentation>
            <data type="int" />
          </element>
        </optional>
        <optional>
          <element name="windowBottom">
            <a:documentation xml:lang="en">The pixel location of the bottom edge of the window.</a:documentation>
            <data type="int" />
          </element>
        </optional>
        <optional>
          <element name="windowLeft">
            <a:documentation xml:lang="en">The pixel location of the left edge of the window.</a:documentation>
            <data type="int" />
          </element>
        </optional>
        <optional>
          <element name="windowRight">
            <a:documentation xml:lang="en">The pixel location of the right edge of the window.</a:documentation>
            <data type="int" />
          </element>
        </optional>
      </interleave>
    </element>
  </define>
  <define name="sharedatts">
    <attribute name="text">
      <a:documentation xml:lang="en">Every outline element must have at least a text attribute, which is what is displayed when an outliner opens the OPML file</a:documentation>
      <data type="string"/>
    </attribute>
    <optional>
      <attribute name="isComment">
        <a:documentation xml:lang="en">Indicates whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to also be commented. If it's not present, the value is false.</a:documentation>
        <choice>
          <value type="string">true</value>
          <value type="string">false</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="isBreakpoint">
        <a:documentation xml:lang="en">Indicates whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts. If it's not present, the value is false.</a:documentation>
        <choice>
          <value type="string">true</value>
          <value type="string">false</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="category">
        <a:documentation xml:lang="en">A string of comma-separated slash-delimited category strings, in the format defined by the RSS 2.0 category element. To represent a "tag," the category string should contain no slashes.</a:documentation>
<!-- <value type="string" /> -->
<text />
      </attribute>
    </optional>
    <optional>
      <attribute name="created">
        <a:documentation xml:lang="en">The date and time that the outline node was created. Follows RFC 822 (eg. "Sat, 09 Apr 2007 14:57:36 GMT").</a:documentation>
        <ref name="rfc_822_opml_rx" />
      </attribute>
    </optional>
  </define>
  <define name="onode1">
      <element name="outline">
        <interleave>
          <ref name="sharedatts" />
          <choice>
            <ref name="weblink"/>
            <ref name="rsslink"/>
            <ref name="song" />
            <zeroOrMore>
              <ref name="onode1"/>
            </zeroOrMore>
          </choice>
        </interleave>
      </element>
  </define>
  <define name="onode2">
    <element name="outline">
      <interleave>
        <ref name="sharedatts" />
        <choice>
          <ref name="weblink"/>
          <ref name="rsslink"/>
          <ref name="include"/>
          <ref name="song" />
          <zeroOrMore>
            <ref name="onode2"/>
          </zeroOrMore>
        </choice>
      </interleave>
    </element>
  </define>
  <define name="weblink">
    <attribute name="type">
      <a:documentation xml:lang="en">A string which says how other attributes are to be interpreted. OPML can also be extended by the addition of new values for the type attribute.</a:documentation>
      <value type="string">link</value>
    </attribute>
    <attribute name="url">
      <data type="string"/>
    </attribute>
  </define>
  <define name="rsslink">
    <attribute name="type">
      <a:documentation xml:lang="en">A string which says how other attributes are to be interpreted. OPML can also be extended by the addition of new values for the type attribute.</a:documentation>
      <value type="string">rss</value>
    </attribute>
    <optional>
      <attribute name="version">
        <a:documentation xml:lang="en">Varies depending on the version of RSS that's being supplied.</a:documentation>
        <choice>
          <value type="string">RSS</value>
          <value type="string">RSS2</value>
          <value type="string">RSS1</value>
          <value type="string">scriptingNews</value>
          <value type="string">atom</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="language">
        <a:documentation xml:lang="en">The value of the top-level language element from the feed.</a:documentation>
        <data type="string" />
      </attribute>
    </optional>
    <optional>
      <attribute name="title">
        <a:documentation xml:lang="en">Contains the top-level title element from the feed.</a:documentation>
        <data type="string" />
      </attribute>
    </optional>
    <attribute name="htmlUrl">
      <a:documentation xml:lang="en">The top-level link element from the RSS feed.</a:documentation>
      <data type="anyURI"/>
    </attribute>
    <optional>
      <attribute name="xmlUrl">
        <a:documentation xml:lang="en">The HTTP address of the RSS feed.</a:documentation>
        <data type="anyURI"/>
      </attribute>
    </optional>
  </define>
  <define name="include">
    <attribute name="type">
      <a:documentation xml:lang="en">A string which says how other attributes are to be interpreted. OPML can also be extended by the addition of new values for the type attribute.</a:documentation>
      <value type="string">include</value>
    </attribute>
    <attribute name="url">
      <data type="anyURI"/>
    </attribute>
  </define>
  <define name="song">
    <attribute name="type">
      <a:documentation xml:lang="en">A string which says how other attributes are to be interpreted. OPML can also be extended by the addition of new values for the type attribute.</a:documentation>
      <value type="string">song</value>
    </attribute>
      <optional>
        <attribute name="f">
          <a:documentation xml:lang="en">The file that contains the MP3 on the local hard drive.</a:documentation>
          <data type="string" />
        </attribute>
      </optional>
      <optional>
        <attribute name="ctPlays">
          <a:documentation xml:lang="en">The number of times the song has been played.</a:documentation>
          <data type="string" />
        </attribute>
      </optional>
      <optional>
        <attribute name="ctSeconds">
          <a:documentation xml:lang="en">The duration of the song, defined by a heuristic that's pretty accurate. ;-></a:documentation>
          <data type="duration" />
        </attribute>
      </optional>
      <optional>
        <attribute name="whenFirstPlayed">
          <a:documentation xml:lang="en">The time/date the song was played for the first time.</a:documentation>
          <ref name="rfc_822_opml_rx" />
        </attribute>
      </optional>
    <optional>
      <attribute name="whenLastPlayed">
        <a:documentation xml:lang="en">The time/date that the song was played most recently.</a:documentation>
        <ref name="rfc_822_opml_rx" />
      </attribute>
    </optional>
    <optional>
      <attribute name="whenLoaded">
        <a:documentation xml:lang="en">The time/date that Radio UserLand discovered the file in your MP3 folder.</a:documentation>
      </attribute>
    </optional>
  </define>
  <define name="commasep">
    <data type="string">
      <param name="pattern">[\-+]?(\d+|\d+(\.\d+)?%)(,\s?(\d+|\d+(\.\d+)?%))*</param>
    </data>
  </define>
  <define name="rfc_822_opml_rx">
    <data type="string">
      <param name="pattern">^((Mon|Tue|Wed|Thur|Fri|Sat|Sun), )?(\d+) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{2,4}) (\d{2}):(\d{2})(:(\d{2})?) (\S{1,4}|(\+|\-)\d{4})$</param>
    </data>
  </define>
</grammar>