atom-app.rng 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. https://www.rfc-editor.org/rfc/rfc5023#appendix-B
  4. -*- rnc -*- # RELAX NG Compact Syntax Grammar for the Atom Protocol
  5. -->
  6. <grammar xmlns:app="http://www.w3.org/2007/app" ns="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  7. <start>
  8. <ref name="appService"/>
  9. </start>
  10. <!-- common:attrs -->
  11. <define name="atomURI">
  12. <text/>
  13. </define>
  14. <define name="appCommonAttributes">
  15. <optional>
  16. <attribute name="xml:base">
  17. <ref name="atomURI"/>
  18. </attribute>
  19. </optional>
  20. <optional>
  21. <attribute name="xml:lang">
  22. <ref name="atomLanguageTag"/>
  23. </attribute>
  24. </optional>
  25. <optional>
  26. <attribute name="xml:space">
  27. <choice>
  28. <value>default</value>
  29. <value>preserved</value>
  30. </choice>
  31. </attribute>
  32. </optional>
  33. <zeroOrMore>
  34. <ref name="undefinedAttribute"/>
  35. </zeroOrMore>
  36. </define>
  37. <define name="atomCommonAttributes">
  38. <ref name="appCommonAttributes"/>
  39. </define>
  40. <define name="undefinedAttribute">
  41. <attribute>
  42. <anyName>
  43. <except>
  44. <name>xml:base</name>
  45. <name>xml:space</name>
  46. <name>xml:lang</name>
  47. <nsName ns=""/>
  48. </except>
  49. </anyName>
  50. </attribute>
  51. </define>
  52. <define name="atomLanguageTag">
  53. <data type="string">
  54. <param name="pattern">([A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*)?</param>
  55. </data>
  56. </define>
  57. <!-- Gregorio & de hOra Standards Track [Page 46] -->
  58. <!-- RFC 5023 The Atom Publishing Protocol October 2007 -->
  59. <define name="atomDateConstruct">
  60. <ref name="appCommonAttributes"/>
  61. <data type="dateTime"/>
  62. </define>
  63. <!-- app:service -->
  64. <define name="appService">
  65. <element name="app:service">
  66. <ref name="appCommonAttributes"/>
  67. <interleave>
  68. <oneOrMore>
  69. <ref name="appWorkspace"/>
  70. </oneOrMore>
  71. <zeroOrMore>
  72. <ref name="extensionElement"/>
  73. </zeroOrMore>
  74. </interleave>
  75. </element>
  76. </define>
  77. <!-- app:workspace -->
  78. <define name="appWorkspace">
  79. <element name="app:workspace">
  80. <ref name="appCommonAttributes"/>
  81. <interleave>
  82. <ref name="atomTitle"/>
  83. <zeroOrMore>
  84. <ref name="appCollection"/>
  85. </zeroOrMore>
  86. <zeroOrMore>
  87. <ref name="extensionSansTitleElement"/>
  88. </zeroOrMore>
  89. </interleave>
  90. </element>
  91. </define>
  92. <define name="atomTitle">
  93. <element name="atom:title">
  94. <ref name="atomTextConstruct"/>
  95. </element>
  96. </define>
  97. <!-- app:collection -->
  98. <define name="appCollection">
  99. <element name="app:collection">
  100. <ref name="appCommonAttributes"/>
  101. <attribute name="href">
  102. <ref name="atomURI"/>
  103. </attribute>
  104. <interleave>
  105. <ref name="atomTitle"/>
  106. <zeroOrMore>
  107. <ref name="appAccept"/>
  108. </zeroOrMore>
  109. <zeroOrMore>
  110. <ref name="appCategories"/>
  111. </zeroOrMore>
  112. <zeroOrMore>
  113. <ref name="extensionSansTitleElement"/>
  114. </zeroOrMore>
  115. </interleave>
  116. </element>
  117. </define>
  118. <!-- app:categories -->
  119. <define name="atomCategory">
  120. <element name="atom:category">
  121. <ref name="atomCommonAttributes"/>
  122. <attribute name="term"/>
  123. <optional>
  124. <attribute name="scheme">
  125. <ref name="atomURI"/>
  126. </attribute>
  127. </optional>
  128. <optional>
  129. <attribute name="label"/>
  130. </optional>
  131. <ref name="undefinedContent"/>
  132. </element>
  133. </define>
  134. <!--
  135. Gregorio & de hOra Standards Track [Page 47]
  136. RFC 5023 The Atom Publishing Protocol October 2007
  137. -->
  138. <define name="appInlineCategories">
  139. <element name="app:categories">
  140. <optional>
  141. <attribute name="fixed">
  142. <choice>
  143. <value>yes</value>
  144. <value>no</value>
  145. </choice>
  146. </attribute>
  147. </optional>
  148. <optional>
  149. <attribute name="scheme">
  150. <ref name="atomURI"/>
  151. </attribute>
  152. </optional>
  153. <group>
  154. <zeroOrMore>
  155. <ref name="atomCategory"/>
  156. </zeroOrMore>
  157. <ref name="undefinedContent"/>
  158. </group>
  159. </element>
  160. </define>
  161. <define name="appOutOfLineCategories">
  162. <element name="app:categories">
  163. <attribute name="href">
  164. <ref name="atomURI"/>
  165. </attribute>
  166. <ref name="undefinedContent"/>
  167. </element>
  168. </define>
  169. <define name="appCategories">
  170. <choice>
  171. <ref name="appInlineCategories"/>
  172. <ref name="appOutOfLineCategories"/>
  173. </choice>
  174. </define>
  175. <!-- app:accept -->
  176. <define name="appAccept">
  177. <element name="app:accept">
  178. <ref name="appCommonAttributes"/>
  179. <optional>
  180. <text/>
  181. </optional>
  182. </element>
  183. </define>
  184. <!-- Simple Extension -->
  185. <define name="simpleSansTitleExtensionElement">
  186. <element>
  187. <anyName>
  188. <except>
  189. <nsName ns="http://www.w3.org/2007/app"/>
  190. <name>atom:title</name>
  191. </except>
  192. </anyName>
  193. <text/>
  194. </element>
  195. </define>
  196. <define name="simpleExtensionElement">
  197. <element>
  198. <anyName>
  199. <except>
  200. <nsName ns="http://www.w3.org/2007/app"/>
  201. </except>
  202. </anyName>
  203. <text/>
  204. </element>
  205. </define>
  206. <!-- Structured Extension -->
  207. <define name="structuredSansTitleExtensionElement">
  208. <element>
  209. <anyName>
  210. <except>
  211. <nsName ns="http://www.w3.org/2007/app"/>
  212. <name>atom:title</name>
  213. </except>
  214. </anyName>
  215. <choice>
  216. <group>
  217. <oneOrMore>
  218. <attribute>
  219. <anyName/>
  220. </attribute>
  221. </oneOrMore>
  222. <zeroOrMore>
  223. <choice>
  224. <text/>
  225. <ref name="anyElement"/>
  226. </choice>
  227. </zeroOrMore>
  228. </group>
  229. <group>
  230. <zeroOrMore>
  231. <attribute>
  232. <anyName/>
  233. </attribute>
  234. </zeroOrMore>
  235. <group>
  236. <optional>
  237. <text/>
  238. </optional>
  239. <oneOrMore>
  240. <ref name="anyElement"/>
  241. </oneOrMore>
  242. <zeroOrMore>
  243. <choice>
  244. <text/>
  245. <ref name="anyElement"/>
  246. </choice>
  247. </zeroOrMore>
  248. </group>
  249. </group>
  250. </choice>
  251. </element>
  252. </define>
  253. <!-- # # Gregorio & de hOra Standards Track [Page 48] -->
  254. <!-- # # RFC 5023 The Atom Publishing Protocol October 2007 -->
  255. <define name="structuredExtensionElement">
  256. <element>
  257. <anyName>
  258. <except>
  259. <nsName ns="http://www.w3.org/2007/app"/>
  260. </except>
  261. </anyName>
  262. <choice>
  263. <group>
  264. <oneOrMore>
  265. <attribute>
  266. <anyName/>
  267. </attribute>
  268. </oneOrMore>
  269. <zeroOrMore>
  270. <choice>
  271. <text/>
  272. <ref name="anyElement"/>
  273. </choice>
  274. </zeroOrMore>
  275. </group>
  276. <group>
  277. <zeroOrMore>
  278. <attribute>
  279. <anyName/>
  280. </attribute>
  281. </zeroOrMore>
  282. <group>
  283. <optional>
  284. <text/>
  285. </optional>
  286. <oneOrMore>
  287. <ref name="anyElement"/>
  288. </oneOrMore>
  289. <zeroOrMore>
  290. <choice>
  291. <text/>
  292. <ref name="anyElement"/>
  293. </choice>
  294. </zeroOrMore>
  295. </group>
  296. </group>
  297. </choice>
  298. </element>
  299. </define>
  300. <!-- Other Extensibility -->
  301. <define name="extensionSansTitleElement">
  302. <choice>
  303. <ref name="simpleSansTitleExtensionElement"/>
  304. <ref name="structuredSansTitleExtensionElement"/>
  305. </choice>
  306. </define>
  307. <define name="extensionElement">
  308. <choice>
  309. <ref name="simpleExtensionElement"/>
  310. <ref name="structuredExtensionElement"/>
  311. </choice>
  312. </define>
  313. <define name="undefinedContent">
  314. <zeroOrMore>
  315. <choice>
  316. <text/>
  317. <ref name="anyForeignElement"/>
  318. </choice>
  319. </zeroOrMore>
  320. </define>
  321. <!-- Extensions -->
  322. <define name="anyElement">
  323. <element>
  324. <anyName/>
  325. <zeroOrMore>
  326. <choice>
  327. <attribute>
  328. <anyName/>
  329. </attribute>
  330. <text/>
  331. <ref name="anyElement"/>
  332. </choice>
  333. </zeroOrMore>
  334. </element>
  335. </define>
  336. <define name="anyForeignElement">
  337. <element>
  338. <anyName>
  339. <except>
  340. <nsName ns="http://www.w3.org/2007/app"/>
  341. </except>
  342. </anyName>
  343. <zeroOrMore>
  344. <choice>
  345. <attribute>
  346. <anyName/>
  347. </attribute>
  348. <text/>
  349. <ref name="anyElement"/>
  350. </choice>
  351. </zeroOrMore>
  352. </element>
  353. </define>
  354. <define name="atomPlainTextConstruct">
  355. <ref name="atomCommonAttributes"/>
  356. <optional>
  357. <attribute name="type">
  358. <choice>
  359. <value>text</value>
  360. <value>html</value>
  361. </choice>
  362. </attribute>
  363. </optional>
  364. <text/>
  365. </define>
  366. <define name="atomXHTMLTextConstruct">
  367. <ref name="atomCommonAttributes"/>
  368. <attribute name="type">
  369. <value>xhtml</value>
  370. </attribute>
  371. <ref name="xhtmlDiv"/>
  372. </define>
  373. <define name="atomTextConstruct">
  374. <choice>
  375. <ref name="atomPlainTextConstruct"/>
  376. <ref name="atomXHTMLTextConstruct"/>
  377. </choice>
  378. </define>
  379. <!-- # Gregorio & de hOra Standards Track [Page 49] -->
  380. <!-- # RFC 5023 The Atom Publishing Protocol October 2007 -->
  381. <define name="anyXHTML">
  382. <element>
  383. <nsName/>
  384. <zeroOrMore>
  385. <choice>
  386. <attribute>
  387. <anyName/>
  388. </attribute>
  389. <text/>
  390. <ref name="anyXHTML"/>
  391. </choice>
  392. </zeroOrMore>
  393. </element>
  394. </define>
  395. <define name="xhtmlDiv">
  396. <element name="xhtml:div">
  397. <zeroOrMore>
  398. <choice>
  399. <attribute>
  400. <anyName/>
  401. </attribute>
  402. <text/>
  403. <ref name="anyXHTML"/>
  404. </choice>
  405. </zeroOrMore>
  406. </element>
  407. </define>
  408. </grammar>
  409. <!-- EOF -->