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