-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSIF.input.schema.rnc
More file actions
executable file
·343 lines (269 loc) · 8.3 KB
/
SIF.input.schema.rnc
File metadata and controls
executable file
·343 lines (269 loc) · 8.3 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# Created by Stuart McGrigor, New Zealand Ministry of Education, October 2017
default namespace = "http://sifassociation.org/SpecGen"
datatypes xs = "http://www.w3.org/2001/XMLSchema-datatypes"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace xhtml = "http://www.w3.org/1999/xhtml"
namespace xml = "http://www.w3.org/XML/1998/namespace"
namespace xs = "http://www.w3.org/2001/XMLSchema"
namespace xsi = "http://www.w3.org/2001/XMLSchema-instance"
namespace xi = "http://www.w3.org/2001/XInclude"
#
## embedded XML Schema definitions
#
xml.lang = attribute xml:lang { text }
xi.include = element xi:include {
attribute parse { "text" | "xml" },
attribute href { text }
}
xs.any = element xs:any {
attribute processContents { "lax" | "skip" | "strict" },
attribute minOccurs { xs:nonNegativeInteger }?,
attribute maxOccurs { xs:nonNegativeInteger | "unbounded"}?,
attribute namespace { "##any" | "##other" | "##local" | "##targetNamespace" }?,
element * { anything }*
}
xs.sequence = element xs:sequence { xs.any+ }
xs.complexContent = element xs:complexContent {
attribute mixed { "true" | "false" },
element xs:* { anything }*
}
#
## embedded HTML (with includes and if)
#
sif.narrative = mixed { (
text
| xi.include
| html.a
| html.br
| html.code
| html.dl
| html.em
| html.h1
| html.h2
| html.h3
| html.h4
| html.img
| html.map
| html.p
| html.span
| html.strong
| html.table
| html.ul
| sif.If.narrative
)* }
html.a = element a {
attribute href { text }?,
attribute name { text }?,
sif.narrative
}
html.br = element br { empty }
html.code = element code { text }
html.dl = element dl { (mixed { sif.If.defList | (html.dt, html.dd+)* })* }
html.dt = element dt { sif.narrative }
html.dd = element dd { (attribute style { text })?, sif.narrative}
html.em = element em { sif.narrative }
html.h1 = element h1 { sif.narrative }
html.h2 = element h2 { sif.narrative }
html.h3 = element h3 { sif.narrative }
html.h4 = element h4 { sif.narrative }
html.img = element img {
attribute src { text },
attribute alt { text }?,
attribute title { text }?,
attribute width { text }?,
attribute style { text }?,
attribute usemap { text }?
}
html.map = element map {
attribute id { text },
attribute name { text },
element area {
attribute title { text},
attribute href { text },
attribute shape { "rect" | "circle" | "poly" },
attribute coords { xs:string { pattern = "\d+\s*(,\s*\d+)*" } }
}+
}
html.p = element p { sif.narrative}
html.span = element span {
attribute class { text },
text
}
html.strong = element strong { sif.narrative }
html.table = element table {
element thead { html.tr+ },
mixed { element tbody { html.tr+ } | html.tr+ } }
html.tr = element tr { html.td+ }
html.td = element td { attribute class { text }?, sif.narrative }
html.ul = element ul { element li { sif.narrative }* }
#
## repeated lego blocks
#
anything = ( element * { anything } | attribute * { text } | text )*
attr.intl = attribute intl { "us" | "uk" | "au" | "nz" | "" }
sif.If.narrative = element if { attr.intl, sif.narrative+ }
sif.If.includeGroup = element if { attr.intl,
(mixed {
xi.include
| sif.CommonElement
| sif.DataObject
| sif.Grouping
| sif.CodeSet })+ }
sif.If.Item = element if { attr.intl, sif.Item+ }
sif.If.Value = element if { attr.intl, sif.Value+ }
sif.If.Type = element if { attr.intl, sif.Type+ }
sif.If.defList = element if { attr.intl, (html.dt?, html.dd)+ }
sif.Intro = element Intro { sif.narrative }
#
## Root Elements (Russian Doll model)
#
start |= sif.SIFSpecification
| sif.Section
| sif.DataObject
| sif.DataObjects
| sif.IncludeGroup
| sif.CodeSets
| sif.Grouping
sif.SIFSpecification =
element SIFSpecification {
attribute xsi:* { text }*,
element BuildComment { sif.narrative },
element TitlePage { sif.narrative },
(mixed {
sif.narrative
| sif.Section
| sif.Appendix })*
}
sif.Section = element Section {
attribute xsi:* { text }*,
attribute name { text }?,
attribute xml:base { text }?,
(mixed {
sif.Section
| sif.narrative
| sif.Intro
| sif.DataObjects
| sif.Domain
| element Example { attribute name { text }, text }
| xhtml.Example } )* }
sif.Appendix = element Appendix {
attribute name { text },
attribute xml:base { text }?,
(mixed {
sif.narrative
| sif.Intro
| sif.IncludeGroup
| sif.CodeSets })* }
xhtml.Example = element xhtml:Example {
attribute name { text },
attribute skipValidate { "true" | "false" }?,
attr.intl?,
element * { anything }
}*
sif.IncludeGroup = element IncludeGroup {
attribute xml:base { text }?,
(mixed {
sif.If.includeGroup
| xi.include
| sif.Intro
| sif.Group
| sif.CommonElement
| sif.CodeSet
| sif.Grouping} )* }
sif.DataObjects = element DataObjects {
attribute xml:base { text }?,
(mixed { sif.Group | sif.If.includeGroup | sif.IncludeGroup | xi.include}* ) }
sif.Key = element Key { text }
sif.EventsReported = element EventsReported { "true" | "false"}
sif.DataObject = element DataObject {
attribute name { text },
(sif.Key | sif.EventsReported)+,
element Intro { sif.narrative }?,
(mixed { sif.If.Item | sif.Item | sif.Choice })*,
xhtml.Example*
}
sif.DomainDataObject = element DataObject {
attribute coords { xs:string { pattern = "\d+\s*(,\s*\d+)*" } }?,
text
}
sif.Domain = element Domain {
attribute name { text },
sif.Intro,
sif.DomainDataObject+
}
sif.CommonElement = element CommonElement {
attribute name { text },
attribute type { "true" | "false"},
attribute dm { "true" | "false"}?,
sif.Intro?,
element Key { text }?,
(mixed { sif.If.Item | sif.Item | sif.Choice })*,
xhtml.Example*
}
sif.Grouping = element Grouping {
attribute code { text },
attribute name { text },
(mixed { sif.If.includeGroup | xi.include | sif.CodeSet}) * }
sif.CodeSet = element CodeSet {
element Intro { sif.narrative }?,
element ID { text },
element Values {
(mixed { sif.If.Value | sif.Value })* } }
sif.Value = element Value {
element Code { text },
element Text { xml.lang?, text }*,
element Description { sif.narrative }?
}
sif.Group = element Group {
attribute name { text },
(mixed {
sif.narrative
| sif.Intro
| sif.DataObject } )* }
sif.CodeSets = element CodeSets {
(mixed {
sif.If.includeGroup
| xi.include
| sif.Grouping} )* }
sif.Attribute = element Attribute { text }
sif.Element = element Element { text }
sif.Item = element Item {
attr.intl?,
(sif.Attribute | sif.Element),
element Characteristics { "M" | "O" | "C" | "MR" | "OR"}?,
element privacyRating { "Low" | "Medium" | "High" | "Extreme"}?,
element Description { sif.narrative }?,
mixed { (
sif.If.Type
| sif.Type
| element Union { sif.Type+ }
| (element ItemExample { text })+
| element List { attribute mode { "List" } }
| sif.Values
| element Facets { mixed { xs.Facets }+ }
) }* }
sif.Type = element Type {
attribute ref { text }?,
attribute name { text }?,
attribute complex { "extension" }?,
(attribute relationship { text }, attribute count { "1:1" | "*:1" | "1:*" | "1:?" | "?:1"} )?,
(mixed { xs.any | xs.sequence | xs.complexContent })?
}
sif.Choice = element Choice { sif.Item+ }
sif.Values = element Values { sif.Value+ }
xs.Facets = element xs:pattern { attribute value { text } }
| element xs:enumeration { xs.valueString, element annotation { element documentation { anything } }? }
| element xs:whiteSpace { attribute value { "collapse" }? }
| element xs:length { xs.valueInteger }
| element xs:minLength { xs.valueInteger }
| element xs:maxLength { xs.valueInteger }
| element xs:totalDigits { xs.valueInteger }
| element xs:fractionDigits { xs.valueInteger }
| element xs:minInclusive {xs.valueDecimal }
| element xs:maxInclusive { xs.valueDecimal }
| element xs:minExclusive {xs.valueDecimal }
| element xs:maxExclusive { xs.valueDecimal }
xs.valueInteger = attribute value { xs:integer }
xs.valueDecimal = attribute value { xs:decimal }
xs.valueString = attribute value { xs:string }