ratom 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,600 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ -*- rnc -*-
4
+ RELAX NG XML Syntax Grammar for the
5
+ Atom Format Specification Version 11
6
+
7
+ Converted from Relax NG Compact Syntax Grammar,
8
+ as seen in RFC 4287.
9
+ -->
10
+ <grammar ns="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
11
+ <start>
12
+ <choice>
13
+ <ref name="atomFeed"/>
14
+ <ref name="atomEntry"/>
15
+ </choice>
16
+ </start>
17
+ <!-- Common attributes -->
18
+ <define name="atomCommonAttributes">
19
+ <optional>
20
+ <attribute name="xml:base">
21
+ <ref name="atomUri"/>
22
+ </attribute>
23
+ </optional>
24
+ <optional>
25
+ <attribute name="xml:lang">
26
+ <ref name="atomLanguageTag"/>
27
+ </attribute>
28
+ </optional>
29
+ <zeroOrMore>
30
+ <ref name="undefinedAttribute"/>
31
+ </zeroOrMore>
32
+ </define>
33
+ <!-- Text Constructs -->
34
+ <define name="atomPlainTextConstruct">
35
+ <ref name="atomCommonAttributes"/>
36
+ <optional>
37
+ <attribute name="type">
38
+ <choice>
39
+ <value>text</value>
40
+ <value>html</value>
41
+ </choice>
42
+ </attribute>
43
+ </optional>
44
+ <text/>
45
+ </define>
46
+ <define name="atomXHTMLTextConstruct">
47
+ <ref name="atomCommonAttributes"/>
48
+ <attribute name="type">
49
+ <value>xhtml</value>
50
+ </attribute>
51
+ <ref name="xhtmlDiv"/>
52
+ </define>
53
+ <define name="atomTextConstruct">
54
+ <choice>
55
+ <ref name="atomPlainTextConstruct"/>
56
+ <ref name="atomXHTMLTextConstruct"/>
57
+ </choice>
58
+ </define>
59
+ <!-- Person Construct -->
60
+ <define name="atomPersonConstruct">
61
+ <ref name="atomCommonAttributes"/>
62
+ <interleave>
63
+ <element name="atom:name">
64
+ <text/>
65
+ </element>
66
+ <optional>
67
+ <element name="atom:uri">
68
+ <ref name="atomUri"/>
69
+ </element>
70
+ </optional>
71
+ <optional>
72
+ <element name="atom:email">
73
+ <ref name="atomEmailAddress"/>
74
+ </element>
75
+ </optional>
76
+ <zeroOrMore>
77
+ <ref name="extensionElement"/>
78
+ </zeroOrMore>
79
+ </interleave>
80
+ </define>
81
+ <!-- Date Construct -->
82
+ <define name="atomDateConstruct">
83
+ <ref name="atomCommonAttributes"/>
84
+ <data type="dateTime"/>
85
+ </define>
86
+ <!-- atom:feed -->
87
+ <define name="atomFeed">
88
+ <element name="atom:feed">
89
+ <s:rule context="atom:feed">
90
+ <s:assert test="atom:author or not(atom:entry[not(atom:author)])">An atom:feed must have an atom:author unless all of its atom:entry children have an atom:author.</s:assert>
91
+ </s:rule>
92
+ <ref name="atomCommonAttributes"/>
93
+ <interleave>
94
+ <zeroOrMore>
95
+ <ref name="atomAuthor"/>
96
+ </zeroOrMore>
97
+ <zeroOrMore>
98
+ <ref name="atomCategory"/>
99
+ </zeroOrMore>
100
+ <zeroOrMore>
101
+ <ref name="atomContributor"/>
102
+ </zeroOrMore>
103
+ <optional>
104
+ <ref name="atomGenerator"/>
105
+ </optional>
106
+ <optional>
107
+ <ref name="atomIcon"/>
108
+ </optional>
109
+ <ref name="atomId"/>
110
+ <zeroOrMore>
111
+ <ref name="atomLink"/>
112
+ </zeroOrMore>
113
+ <optional>
114
+ <ref name="atomLogo"/>
115
+ </optional>
116
+ <optional>
117
+ <ref name="atomRights"/>
118
+ </optional>
119
+ <optional>
120
+ <ref name="atomSubtitle"/>
121
+ </optional>
122
+ <ref name="atomTitle"/>
123
+ <ref name="atomUpdated"/>
124
+ <zeroOrMore>
125
+ <ref name="extensionElement"/>
126
+ </zeroOrMore>
127
+ </interleave>
128
+ <zeroOrMore>
129
+ <ref name="atomEntry"/>
130
+ </zeroOrMore>
131
+ </element>
132
+ </define>
133
+ <!-- atom:entry -->
134
+ <define name="atomEntry">
135
+ <element name="atom:entry">
136
+ <s:rule context="atom:entry">
137
+ <s:assert test="atom:link[@rel='alternate'] or atom:link[not(@rel)] or atom:content">An atom:entry must have at least one atom:link element with a rel attribute of 'alternate' or an atom:content.</s:assert>
138
+ </s:rule>
139
+ <s:rule context="atom:entry">
140
+ <s:assert test="atom:author or ../atom:author or atom:source/atom:author">An atom:entry must have an atom:author if its feed does not.</s:assert>
141
+ </s:rule>
142
+ <ref name="atomCommonAttributes"/>
143
+ <interleave>
144
+ <zeroOrMore>
145
+ <ref name="atomAuthor"/>
146
+ </zeroOrMore>
147
+ <zeroOrMore>
148
+ <ref name="atomCategory"/>
149
+ </zeroOrMore>
150
+ <optional>
151
+ <ref name="atomContent"/>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="atomContributor"/>
155
+ </zeroOrMore>
156
+ <ref name="atomId"/>
157
+ <zeroOrMore>
158
+ <ref name="atomLink"/>
159
+ </zeroOrMore>
160
+ <optional>
161
+ <ref name="atomPublished"/>
162
+ </optional>
163
+ <optional>
164
+ <ref name="atomRights"/>
165
+ </optional>
166
+ <optional>
167
+ <ref name="atomSource"/>
168
+ </optional>
169
+ <optional>
170
+ <ref name="atomSummary"/>
171
+ </optional>
172
+ <ref name="atomTitle"/>
173
+ <ref name="atomUpdated"/>
174
+ <zeroOrMore>
175
+ <ref name="extensionElement"/>
176
+ </zeroOrMore>
177
+ </interleave>
178
+ </element>
179
+ </define>
180
+ <!-- atom:content -->
181
+ <define name="atomInlineTextContent">
182
+ <element name="atom:content">
183
+ <ref name="atomCommonAttributes"/>
184
+ <optional>
185
+ <attribute name="type">
186
+ <choice>
187
+ <value>text</value>
188
+ <value>html</value>
189
+ </choice>
190
+ </attribute>
191
+ </optional>
192
+ <zeroOrMore>
193
+ <text/>
194
+ </zeroOrMore>
195
+ </element>
196
+ </define>
197
+ <define name="atomInlineXHTMLContent">
198
+ <element name="atom:content">
199
+ <ref name="atomCommonAttributes"/>
200
+ <attribute name="type">
201
+ <value>xhtml</value>
202
+ </attribute>
203
+ <ref name="xhtmlDiv"/>
204
+ </element>
205
+ </define>
206
+ <define name="atomInlineOtherContent">
207
+ <element name="atom:content">
208
+ <ref name="atomCommonAttributes"/>
209
+ <optional>
210
+ <attribute name="type">
211
+ <ref name="atomMediaType"/>
212
+ </attribute>
213
+ </optional>
214
+ <zeroOrMore>
215
+ <choice>
216
+ <text/>
217
+ <ref name="anyElement"/>
218
+ </choice>
219
+ </zeroOrMore>
220
+ </element>
221
+ </define>
222
+ <define name="atomOutOfLineContent">
223
+ <element name="atom:content">
224
+ <ref name="atomCommonAttributes"/>
225
+ <optional>
226
+ <attribute name="type">
227
+ <ref name="atomMediaType"/>
228
+ </attribute>
229
+ </optional>
230
+ <attribute name="src">
231
+ <ref name="atomUri"/>
232
+ </attribute>
233
+ <empty/>
234
+ </element>
235
+ </define>
236
+ <define name="atomContent">
237
+ <choice>
238
+ <ref name="atomInlineTextContent"/>
239
+ <ref name="atomInlineXHTMLContent"/>
240
+ <ref name="atomInlineOtherContent"/>
241
+ <ref name="atomOutOfLineContent"/>
242
+ </choice>
243
+ </define>
244
+ <!-- atom:author -->
245
+ <define name="atomAuthor">
246
+ <element name="atom:author">
247
+ <ref name="atomPersonConstruct"/>
248
+ </element>
249
+ </define>
250
+ <!-- atom:category -->
251
+ <define name="atomCategory">
252
+ <element name="atom:category">
253
+ <ref name="atomCommonAttributes"/>
254
+ <attribute name="term"/>
255
+ <optional>
256
+ <attribute name="scheme">
257
+ <ref name="atomUri"/>
258
+ </attribute>
259
+ </optional>
260
+ <optional>
261
+ <attribute name="label"/>
262
+ </optional>
263
+ <ref name="undefinedContent"/>
264
+ </element>
265
+ </define>
266
+ <!-- atom:contributor -->
267
+ <define name="atomContributor">
268
+ <element name="atom:contributor">
269
+ <ref name="atomPersonConstruct"/>
270
+ </element>
271
+ </define>
272
+ <!-- atom:generator -->
273
+ <define name="atomGenerator">
274
+ <element name="atom:generator">
275
+ <ref name="atomCommonAttributes"/>
276
+ <optional>
277
+ <attribute name="uri">
278
+ <ref name="atomUri"/>
279
+ </attribute>
280
+ </optional>
281
+ <optional>
282
+ <attribute name="version"/>
283
+ </optional>
284
+ <text/>
285
+ </element>
286
+ </define>
287
+ <!-- atom:icon -->
288
+ <define name="atomIcon">
289
+ <element name="atom:icon">
290
+ <ref name="atomCommonAttributes"/>
291
+ <ref name="atomUri"/>
292
+ </element>
293
+ </define>
294
+ <!-- atom:id -->
295
+ <define name="atomId">
296
+ <element name="atom:id">
297
+ <ref name="atomCommonAttributes"/>
298
+ <ref name="atomUri"/>
299
+ </element>
300
+ </define>
301
+ <!-- atom:logo -->
302
+ <define name="atomLogo">
303
+ <element name="atom:logo">
304
+ <ref name="atomCommonAttributes"/>
305
+ <ref name="atomUri"/>
306
+ </element>
307
+ </define>
308
+ <!-- atom:link -->
309
+ <define name="atomLink">
310
+ <element name="atom:link">
311
+ <ref name="atomCommonAttributes"/>
312
+ <attribute name="href">
313
+ <ref name="atomUri"/>
314
+ </attribute>
315
+ <optional>
316
+ <attribute name="rel">
317
+ <choice>
318
+ <ref name="atomNCName"/>
319
+ <ref name="atomUri"/>
320
+ </choice>
321
+ </attribute>
322
+ </optional>
323
+ <optional>
324
+ <attribute name="type">
325
+ <ref name="atomMediaType"/>
326
+ </attribute>
327
+ </optional>
328
+ <optional>
329
+ <attribute name="hreflang">
330
+ <ref name="atomLanguageTag"/>
331
+ </attribute>
332
+ </optional>
333
+ <optional>
334
+ <attribute name="title"/>
335
+ </optional>
336
+ <optional>
337
+ <attribute name="length"/>
338
+ </optional>
339
+ <ref name="undefinedContent"/>
340
+ </element>
341
+ </define>
342
+ <!-- atom:published -->
343
+ <define name="atomPublished">
344
+ <element name="atom:published">
345
+ <ref name="atomDateConstruct"/>
346
+ </element>
347
+ </define>
348
+ <!-- atom:rights -->
349
+ <define name="atomRights">
350
+ <element name="atom:rights">
351
+ <ref name="atomTextConstruct"/>
352
+ </element>
353
+ </define>
354
+ <!-- atom:source -->
355
+ <define name="atomSource">
356
+ <element name="atom:source">
357
+ <ref name="atomCommonAttributes"/>
358
+ <interleave>
359
+ <zeroOrMore>
360
+ <ref name="atomAuthor"/>
361
+ </zeroOrMore>
362
+ <zeroOrMore>
363
+ <ref name="atomCategory"/>
364
+ </zeroOrMore>
365
+ <zeroOrMore>
366
+ <ref name="atomContributor"/>
367
+ </zeroOrMore>
368
+ <optional>
369
+ <ref name="atomGenerator"/>
370
+ </optional>
371
+ <optional>
372
+ <ref name="atomIcon"/>
373
+ </optional>
374
+ <optional>
375
+ <ref name="atomId"/>
376
+ </optional>
377
+ <zeroOrMore>
378
+ <ref name="atomLink"/>
379
+ </zeroOrMore>
380
+ <optional>
381
+ <ref name="atomLogo"/>
382
+ </optional>
383
+ <optional>
384
+ <ref name="atomRights"/>
385
+ </optional>
386
+ <optional>
387
+ <ref name="atomSubtitle"/>
388
+ </optional>
389
+ <optional>
390
+ <ref name="atomTitle"/>
391
+ </optional>
392
+ <optional>
393
+ <ref name="atomUpdated"/>
394
+ </optional>
395
+ <zeroOrMore>
396
+ <ref name="extensionElement"/>
397
+ </zeroOrMore>
398
+ </interleave>
399
+ </element>
400
+ </define>
401
+ <!-- atom:subtitle -->
402
+ <define name="atomSubtitle">
403
+ <element name="atom:subtitle">
404
+ <ref name="atomTextConstruct"/>
405
+ </element>
406
+ </define>
407
+ <!-- atom:summary -->
408
+ <define name="atomSummary">
409
+ <element name="atom:summary">
410
+ <ref name="atomTextConstruct"/>
411
+ </element>
412
+ </define>
413
+ <!-- atom:title -->
414
+ <define name="atomTitle">
415
+ <element name="atom:title">
416
+ <ref name="atomTextConstruct"/>
417
+ </element>
418
+ </define>
419
+ <!-- atom:updated -->
420
+ <define name="atomUpdated">
421
+ <element name="atom:updated">
422
+ <ref name="atomDateConstruct"/>
423
+ </element>
424
+ </define>
425
+ <!-- Low-level simple types -->
426
+ <define name="atomNCName">
427
+ <data type="string">
428
+ <param name="minLength">1</param>
429
+ <param name="pattern">[^:]*</param>
430
+ </data>
431
+ </define>
432
+ <!-- Whatever a media type is, it contains at least one slash -->
433
+ <define name="atomMediaType">
434
+ <data type="string">
435
+ <param name="pattern">.+/.+</param>
436
+ </data>
437
+ </define>
438
+ <!-- As defined in RFC 3066 -->
439
+ <define name="atomLanguageTag">
440
+ <data type="string">
441
+ <param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param>
442
+ </data>
443
+ </define>
444
+ <!--
445
+ Unconstrained; it's not entirely clear how IRI fit into
446
+ xsd:anyURI so let's not try to constrain it here
447
+ -->
448
+ <define name="atomUri">
449
+ <text/>
450
+ </define>
451
+ <!-- Whatever an email address is, it contains at least one @ -->
452
+ <define name="atomEmailAddress">
453
+ <data type="string">
454
+ <param name="pattern">.+@.+</param>
455
+ </data>
456
+ </define>
457
+ <!-- Simple Extension -->
458
+ <define name="simpleExtensionElement">
459
+ <element>
460
+ <anyName>
461
+ <except>
462
+ <nsName ns="http://www.w3.org/2005/Atom"/>
463
+ </except>
464
+ </anyName>
465
+ <text/>
466
+ </element>
467
+ </define>
468
+ <!-- Structured Extension -->
469
+ <define name="structuredExtensionElement">
470
+ <element>
471
+ <anyName>
472
+ <except>
473
+ <nsName ns="http://www.w3.org/2005/Atom"/>
474
+ </except>
475
+ </anyName>
476
+ <choice>
477
+ <group>
478
+ <oneOrMore>
479
+ <attribute>
480
+ <anyName/>
481
+ </attribute>
482
+ </oneOrMore>
483
+ <zeroOrMore>
484
+ <choice>
485
+ <text/>
486
+ <ref name="anyElement"/>
487
+ </choice>
488
+ </zeroOrMore>
489
+ </group>
490
+ <group>
491
+ <zeroOrMore>
492
+ <attribute>
493
+ <anyName/>
494
+ </attribute>
495
+ </zeroOrMore>
496
+ <group>
497
+ <optional>
498
+ <text/>
499
+ </optional>
500
+ <oneOrMore>
501
+ <ref name="anyElement"/>
502
+ </oneOrMore>
503
+ <zeroOrMore>
504
+ <choice>
505
+ <text/>
506
+ <ref name="anyElement"/>
507
+ </choice>
508
+ </zeroOrMore>
509
+ </group>
510
+ </group>
511
+ </choice>
512
+ </element>
513
+ </define>
514
+ <!-- Other Extensibility -->
515
+ <define name="extensionElement">
516
+ <choice>
517
+ <ref name="simpleExtensionElement"/>
518
+ <ref name="structuredExtensionElement"/>
519
+ </choice>
520
+ </define>
521
+ <define name="undefinedAttribute">
522
+ <attribute>
523
+ <anyName>
524
+ <except>
525
+ <name>xml:base</name>
526
+ <name>xml:lang</name>
527
+ <nsName ns=""/>
528
+ </except>
529
+ </anyName>
530
+ </attribute>
531
+ </define>
532
+ <define name="undefinedContent">
533
+ <zeroOrMore>
534
+ <choice>
535
+ <text/>
536
+ <ref name="anyForeignElement"/>
537
+ </choice>
538
+ </zeroOrMore>
539
+ </define>
540
+ <define name="anyElement">
541
+ <element>
542
+ <anyName/>
543
+ <zeroOrMore>
544
+ <choice>
545
+ <attribute>
546
+ <anyName/>
547
+ </attribute>
548
+ <text/>
549
+ <ref name="anyElement"/>
550
+ </choice>
551
+ </zeroOrMore>
552
+ </element>
553
+ </define>
554
+ <define name="anyForeignElement">
555
+ <element>
556
+ <anyName>
557
+ <except>
558
+ <nsName ns="http://www.w3.org/2005/Atom"/>
559
+ </except>
560
+ </anyName>
561
+ <zeroOrMore>
562
+ <choice>
563
+ <attribute>
564
+ <anyName/>
565
+ </attribute>
566
+ <text/>
567
+ <ref name="anyElement"/>
568
+ </choice>
569
+ </zeroOrMore>
570
+ </element>
571
+ </define>
572
+ <!-- XHTML -->
573
+ <define name="anyXHTML">
574
+ <element>
575
+ <nsName/>
576
+ <zeroOrMore>
577
+ <choice>
578
+ <attribute>
579
+ <anyName/>
580
+ </attribute>
581
+ <text/>
582
+ <ref name="anyXHTML"/>
583
+ </choice>
584
+ </zeroOrMore>
585
+ </element>
586
+ </define>
587
+ <define name="xhtmlDiv">
588
+ <element name="xhtml:div">
589
+ <zeroOrMore>
590
+ <choice>
591
+ <attribute>
592
+ <anyName/>
593
+ </attribute>
594
+ <text/>
595
+ <ref name="anyXHTML"/>
596
+ </choice>
597
+ </zeroOrMore>
598
+ </element>
599
+ </define>
600
+ </grammar>