-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIF.input.schema.rnc
184 lines (152 loc) · 4.8 KB
/
SIF.input.schema.rnc
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
# Created by Stuart McGrigor, New Zealand Ministry of Education, October 2017
#
# compact Relax NG schema for SIF Specifications
# hand-crafted by Stuart to validate existing SIF Specification files
#
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 xs = "http://www.w3.org/2001/XMLSchema"
namespace xsi = "http://www.w3.org/2001/XMLSchema-instance"
namespace xi = "http://www.w3.org/2001/XInclude"
#
## xi:include elements
#
xi.include = element xi:include {
attribute parse { "text" | "xml" },
attribute href { text }
}
#
## a subset of HTML is embedded in content (with xi:includes)
#
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.p
| html.span
| html.ul
| sif.Example
)* }
html.a = element a {
attribute href { text },
sif.narrative
}
html.br = element br { empty }
html.code = element code { text }
html.dl = element dl { (
element dt { sif.narrative }?,
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 }?
}
html.p = element p { sif.narrative}
html.span = element span {
attribute class { text },
text
}
html.ul = element ul { element li { sif.narrative }* }
sif.section = (attribute name { text })?, (mixed {
sif.narrative
| sif.If
| element CodeSets {sif.narrative}
| element Intro { sif.narrative }
| element Section { sif.section }
} )*
#
## Root Elements (Russian Doll model)
#
start |= sif.SIFSpecification
| sif.Section
| sif.CommonElements
| sif.DataObject
| sif.DataObjects
| sif.IncludeGroup
#
## Main root element
#
sif.SIFSpecification =
element SIFSpecification {
attribute xsi:* { text } *,
element BuildComment { sif.narrative },
element TitlePage { sif.narrative },
(mixed {
sif.narrative
| element Section { sif.section }
| element Appendix { sif.section} } )*
}
sif.CommonElements = element CommonElements { sif.section }
sif.DataObject = element DataObject {
attribute name { text },
(element Key { text } | element EventsReported { "true" | "false" })+,
element Intro { sif.narrative }?,
element Item {
(element Attribute { text } | element Element { text }),
element Characteristics { "M" | "O" | "C" | "MR" | "OR"}?,
element privacyRating { "M" | "L" }?,
element Description { sif.narrative }?,
mixed { ( sif.Type | element Union { sif.Type+ } | (element ItemExample { text })+
| element List { attribute mode { "List" } }
| element Values { element Value { element Code { text } }+ }
| element Facets { mixed { xs.Facets }+ }
) }*
}*,
element xhtml:Example {
attribute name { text },
element * { anything }
}*
}
anything = ( element * { anything } | attribute * { text } | text )*
sif.DataObjects = element DataObjects { sif.section }
sif.If = element if { attribute intl { "us" | "uk" | "au" | "nz" }, sif.narrative }
sif.IncludeGroup = element IncludeGroup {
element Group {
attribute name { text },
(mixed {
sif.narrative
| sif.If
| element Intro { sif.narrative} } )*
}
}
sif.Section = element Section { attribute xsi:* { text } *, sif.section }
sif.Example = element Example {
attribute name { text },
text }
sif.Type = element Type {
attribute ref { text }?,
attribute name { text }?,
attribute complex { "extension" }?,
(attribute relationship { text }, attribute count { "1:1" | "*:1" | "1:*" | "1:?" } )? }
xs.Facets = element xs:pattern { 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.valueInteger }
| element xs:maxInclusive { xs.valueInteger }
| element xs:minExclusive {xs.valueInteger }
| element xs:maxExclusive { xs.valueInteger }
xs.valueInteger = attribute value { xs:integer }
xs.valueString = attribute value { xs:string }