-
Notifications
You must be signed in to change notification settings - Fork 51
/
demo.xsd
555 lines (503 loc) · 21.4 KB
/
demo.xsd
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<xs:schema targetNamespace="http://org.moten.david/xsd-forms/demo"
xmlns="http://org.moten.david/xsd-forms/demo" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:i="http://moten.david.org/xsd-forms" elementFormDefault="qualified">
<xs:annotation i:numberItems="true" />
<xs:element name="main" type="main" />
<xs:complexType name="main">
<xs:sequence>
<xs:element name="text-element" type="xs:string">
<xs:annotation i:title="Demonstration of xsd-forms features"
i:before="This page demonstrates the main features of generated forms using xsd-forms. The schema used to generate this form is demo.xsd.">
</xs:annotation>
</xs:element>
<xs:element name="text-element-with-default" type="xs:string"
default="default" />
<xs:element name="long-text" type="xs:string">
<xs:annotation i:text="textarea" />
</xs:element>
<xs:element name="long-text-with-default" type="xs:string"
default="default">
<xs:annotation i:text="textarea" />
</xs:element>
<xs:element name="decimal-element" type="xs:decimal">
<xs:annotation i:title="Numbers" />
</xs:element>
<xs:element name="decimal-element-with-default" type="xs:decimal"
default="10.0435" />
<xs:element name="integer-element" type="xs:integer" />
<xs:element name="integer-element-with-default" type="xs:integer"
default="123" />
<xs:element name="date-element" type="xs:date">
<xs:annotation i:title="Dates and times" />
</xs:element>
<xs:element name="date-element-with-default2" type="xs:date"
default="1973-06-12" />
<xs:element name="time-element" type="xs:time" />
<xs:element name="time-element-with-default" type="xs:time"
default="21:55:00" />
<xs:element name="datetime-element" type="xs:dateTime">
<xs:annotation i:label="datetime element TODO" />
</xs:element>
<xs:element name="datetime-element-with-default" type="xs:dateTime"
default="2002-05-30T09:30:00">
<xs:annotation i:label="Datetime element with default TODO" />
</xs:element>
<xs:element name="boolean-element" type="xs:boolean">
<xs:annotation i:title="Booleans" />
</xs:element>
<xs:element name="boolean-element-with-default" type="xs:boolean"
default="true" />
<xs:element name="string-enumeration" type="string-enumeration">
<xs:annotation i:title="Enumerations" />
</xs:element>
<xs:element name="string-enumeration-unselected" type="string-enumeration">
<xs:annotation i:addBlank="true" />
</xs:element>
<xs:element name="string-enumeration-with-labels" type="string-enumeration-with-labels" />
<xs:element name="decimal-enumeration" type="decimal-enumeration">
<xs:annotation i:label="Decimal enumeration" />
</xs:element>
<xs:element name="integer-enumeration" type="integer-enumeration" />
<xs:element name="string-enumeration-radio" type="string-enumeration-with-labels">
<xs:annotation i:selector="radio" />
</xs:element>
<xs:element name="make-visible-example" type="make-visible-enumeration">
<xs:annotation i:title="Make visible example"
i:before="When Option B is selected then the next (makeVisible=1) input element will be made visible so that Further Details for Option B can be captured. The Further Details element should have i:visible=false annotation." />
</xs:element>
<xs:element name="further-details-for-option-b" type="xs:string">
<xs:annotation i:visible="false" />
</xs:element>
<xs:element name="label-override" type="xs:string">
<xs:annotation i:label="Label overriden"
i:title="Labels, before, after, title, description" />
</xs:element>
<xs:element name="with-all" type="string-pattern">
<xs:annotation i:title="'title' message" i:before="'before' message"
i:description="description of the field here" i:after="'after' message"
i:label="With all comments"
i:validation="Invalid format, must start with a,b or c and be followed by 3 digits." />
</xs:element>
<xs:element name="css-override" type="xs:string">
<xs:annotation i:text="textarea"
i:css="color:white;height:12em;width:12em;background:orange"
i:title="CSS override of input elements" />
</xs:element>
<xs:element name="string-pattern" type="string-pattern">
<xs:annotation i:description="a,b, or c followed by 3 digits"
i:title="Patterns validation" />
</xs:element>
<xs:element name="string-pattern-validation-msg" type="string-pattern">
<xs:annotation i:description="a,b, or c followed by 3 digits"
i:validation="Invalid format, must start with a,b or c and be followed by 3 digits." />
</xs:element>
<xs:element name="string-multiple-pattern">
<xs:annotation i:description="AB or CD (multiple patterns is logical OR)"
i:validation="Invalid format, must be AB or CD." i:title="Multiple pattern validation"
i:label="String multiple pattern" />
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="AB" />
<xs:pattern value="CD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="string-min-length-validation">
<xs:annotation i:description="minimum 3 characters"
i:validation="Invalid format, must have a minimum of 3 characters."
i:title="Min length validation" />
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-min-length-validation">
<xs:annotation i:description="minimum 3 digits"
i:validation="Invalid format, must have a minimum of 3 digits." />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-min-length-validation">
<xs:annotation i:description="minimum 3 characters"
i:validation="Invalid format, must have a minimum of 3 characters." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="string-max-length-validation">
<xs:annotation i:description="maximum 4 characters"
i:validation="Invalid format, must have a maximum of 4 characters."
i:title="Max length validation" />
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-max-length-validation">
<xs:annotation i:description="maximum 4 digits"
i:validation="Invalid format, must have a maximum of 4 digits." />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:maxInclusive value="9999" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-max-length-validation">
<xs:annotation i:description="maximum 4 characters"
i:validation="Invalid format, must have a maximum of 4 characters." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="string-length-validation">
<xs:annotation i:description="exactly 4 characters"
i:validation="Invalid format, must have exactly 4 characters."
i:title="Length validation" />
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="4" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-length-validation">
<xs:annotation i:description="exactly 4 digits"
i:validation="Invalid format, must have exactly 4 digits." />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1000" />
<xs:maxInclusive value="9999" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-length-validation">
<xs:annotation i:description="exactly 4 characters"
i:validation="Invalid format, must be a decimal value with exactly 4 characters." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0" />
<xs:maxInclusive value="9999" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-min-inclusive-validation">
<xs:annotation i:description="5 or more"
i:validation="Invalid format, must be greater than or equal to 5."
i:title="Min inclusive validation" />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-min-inclusive-validation">
<xs:annotation i:description="5 or more"
i:validation="Invalid format, must be greater than or equal to 5." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-max-inclusive-validation">
<xs:annotation i:description="maximum value of 10"
i:validation="Invalid format, must less than or equal to 10."
i:title="Max inclusive validation" />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:maxInclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-max-inclusive-validation">
<xs:annotation i:description="maximum value of 10"
i:validation="Invalid format, must less than or equal to 10." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:maxInclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-min-exclusive-validation">
<xs:annotation i:description="greater than 5"
i:validation="Invalid format, must be greater than 5."
i:title="Min exclusive validation" />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minExclusive value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-min-exclusive-validation">
<xs:annotation i:description="greater than 5"
i:validation="Invalid format, must be greater than 5." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minExclusive value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="integer-max-exclusive-validation">
<xs:annotation i:description="less than 10"
i:validation="Invalid format, must be an integer less than 10."
i:title="Max exclusive validation" />
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:maxExclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="decimal-max-exclusive-validation">
<xs:annotation i:description="less than 10"
i:validation="Invalid format, must be less than 10." />
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:maxExclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="anonymous-choice-displayed-after">
<xs:complexType>
<xs:choice>
<xs:annotation i:label="Anonymous choice, displayed after" />
<xs:element name="choice-1" type="xs:string">
<xs:annotation i:label="" i:choiceLabel="Choice 1" />
</xs:element>
<xs:element name="choice-2" type="xs:date">
<xs:annotation i:label="" i:choiceLabel="Choice 2" />
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="max-occurs-example-1" type="xs:decimal"
maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable item"
i:label="Number" />
</xs:element>
<xs:element name="max-occurs-example-2" type="xs:decimal"
minOccurs="0" maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable item minOccurs=0"
i:label="Number" />
</xs:element>
<xs:element name="max-occurs-example-3" type="xs:string"
maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable item with button label"
i:label="String" i:repeatLabel="Another" />
</xs:element>
<xs:element name="max-occurs-example-4" maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable complex type" />
<xs:complexType>
<xs:sequence>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="max-occurs-example-5" maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable choice" />
<xs:complexType>
<xs:choice>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="max-occurs-example-6" maxOccurs="unbounded">
<xs:annotation i:nonRepeatingTitle="Repeatable complex type with title"
i:label="Two items" />
<xs:complexType>
<xs:sequence>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="optional" type="xs:string" minOccurs="0">
<xs:annotation i:title="Optional elements"
i:label="Optional string"
i:before="Setting minOccurs=0 on an element means that if the entry is left blank at submit then the xml element will be excluded from the final xml." />
</xs:element>
<xs:element name="anonymous-simple-type">
<xs:annotation i:label="Up to four digits"
i:title="Anonymous simple type" />
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{0,4}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="named-complex-type" type="named-complex-type">
<xs:annotation i:label="Named complex type"
i:title="Complex types" />
</xs:element>
<xs:element name="anonymous-complex-type">
<xs:annotation i:label="Anonymous complex type" />
<xs:complexType>
<xs:sequence>
<xs:element name="string-field" type="xs:string">
<xs:annotation i:label="Value" />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="anonymous-complex-type-with-repeat">
<xs:complexType>
<xs:sequence>
<xs:element name="string-field" type="xs:string"
maxOccurs="unbounded">
<xs:annotation i:label="Anon complex type with repeat" />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="named-complex-type-with-repeat" type="sequence-example"
maxOccurs="unbounded">
<xs:annotation i:label="Named complex type with repeat TODO" />
</xs:element>
<xs:element name="fieldset-example" type="sequence-example">
<xs:annotation i:legend="Fieldset example" />
</xs:element>
<xs:element name="minoccurs-greater-than-one" type="xs:string"
minOccurs="3" maxOccurs="3">
<xs:annotation
i:before="No buttons visible for addition/removal because minOccurs=maxOccurs=3" />
</xs:element>
<xs:element name="min-occurs-zero-sequence" type="named-complex-type"
minOccurs="0" maxOccurs="1">
<xs:annotation i:nonRepeatingTitle="MinOccurs=0 for a sequence" />
</xs:element>
<xs:element name="datatype-int" type="xs:int" default="-123" />
<xs:element name="datatype-long" type="xs:long"
default="-1234" />
<xs:element name="datatype-short" type="xs:short"
default="12" />
<xs:element name="datatype-positive-integer" type="xs:positiveInteger"
default="12345" />
<xs:element name="datatype-negative-integer" type="xs:negativeInteger"
default="-12345" />
<xs:element name="datatype-non-negative-integer" type="xs:nonNegativeInteger"
default="123456" />
<xs:element name="datatype-non-positive-integer" type="xs:nonPositiveInteger"
default="0" />
<xs:element name="extension" type="extension2">
<xs:annotation i:label="Extension example using sequences" />
</xs:element>
<xs:element name="boolean-make-visible-on-true" type="xs:boolean">
<xs:annotation i:makeVisible="true->1"/>
</xs:element>
<xs:element name="boolean-make-visible-on-true-details" type="xs:string" minOccurs="0">
<xs:annotation i:visible="false"/>
</xs:element>
<xs:element name="boolean-make-visible-on-true-default-true" type="xs:boolean" default="true">
<xs:annotation i:makeVisible="true->1"/>
</xs:element>
<xs:element name="boolean-make-visible-on-true-default-true-details" type="xs:string" minOccurs="0">
<xs:annotation i:visible="true" i:label="Details"/>
</xs:element>
<xs:element name="boolean-make-visible-on-false" type="xs:boolean">
<xs:annotation i:makeVisible="false->1"/>
</xs:element>
<xs:element name="boolean-make-visible-on-false-details" type="xs:string" minOccurs="0">
<xs:annotation i:visible="true" i:label="Details"/>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- type definitions -->
<xs:simpleType name="string-enumeration">
<xs:restriction base="xs:string">
<xs:enumeration value="option-1" />
<xs:enumeration value="option-2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="string-enumeration-with-labels">
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation i:label="Option A" />
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation i:label="Option B" />
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="decimal-enumeration">
<xs:restriction base="xs:decimal">
<xs:enumeration value="1.5">
<xs:annotation i:label="One Point Five" />
</xs:enumeration>
<xs:enumeration value="2.0">
<xs:annotation i:label="Two Point Zero" />
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="integer-enumeration">
<xs:restriction base="xs:string">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="make-visible-enumeration">
<xs:restriction base="xs:string">
<xs:enumeration value="A">
<xs:annotation i:label="Option A" />
</xs:enumeration>
<xs:enumeration value="B">
<xs:annotation i:label="Option B" i:makeVisible="1" />
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="string-pattern">
<xs:restriction base="xs:string">
<xs:pattern value="(a|b|c)[0-9]{3}" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="named-complex-type">
<xs:sequence>
<xs:element name="first" type="xs:string" />
<xs:element name="second" type="xs:string" />
<xs:element name="nested" type="sequence-example">
<xs:annotation i:label="Nested named complex type" />
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sequence-example">
<xs:sequence>
<xs:element name="A" type="xs:string" />
<xs:element name="B" type="xs:string" />
<xs:element name="C" type="xs:boolean" />
<xs:element name="option" type="string-enumeration" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="name-value">
<xs:sequence>
<xs:element name="name" type="xs:string" default="name1" />
<xs:element name="value" type="xs:string" default="value1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="extension1">
<xs:complexContent>
<xs:extension base="name-value">
<xs:sequence>
<xs:element name="group" type="xs:string" default="group1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="extension2">
<xs:complexContent>
<xs:extension base="extension1">
<xs:sequence>
<xs:element name="category" type="xs:string"
default="category1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>