comparison src/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng @ 0:0961a4a21176

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 31822b475baa
comparison
equal deleted inserted replaced
-1:000000000000 0:587cff761f98
1 <?xml version="1.0"?>
2 <grammar xmlns="http://relaxng.org/ns/structure/1.0"
3 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
4 ns="http://www.w3.org/2001/XMLSchema"
5 xmlns:xs="http://www.w3.org/2001/XMLSchema"
6 xmlns:doc="http://www.jenitennison.com/doc"
7 xmlns:txw="http://java.sun.com/txw">
8
9 <doc:p>
10 RELAX NG schema for XML Schema by <doc:link
11 href="mailto:mail@jenitennison.com">Jeni Tennison</doc:link>. Based on
12 <doc:link href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML
13 Schema Part I: Structures Recommendation</doc:link> and <doc:link
14 href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">XML Schema Part
15 II: Datatypes</doc:link>.
16 </doc:p>
17 <doc:changes date="2001-11-24">
18 <doc:p>
19 Amended to comply with 10 August 2001 Tutorial.
20 </doc:p>
21 <doc:change>Removed key attributes.</doc:change>
22 <doc:change>Replaced not element with except elements.</doc:change>
23 <doc:change>
24 Replaced multiple consecutive optional attributes to use the
25 zeroOrMore/choice pattern.
26 </doc:change>
27 <doc:change>
28 Removed interleave elements inside list elements (which are no longer
29 permitted).
30 </doc:change>
31 </doc:changes>
32
33 <define name="openAttrs" txw:mode="inherit">
34 <doc:p>
35 This allows any number of attributes that are not in the XML Schema
36 namespace or are in no namespace. This is somewhat more complicated than
37 the XML Schema anyAttribute equivalent.
38 </doc:p>
39 <!-- KK don't care -->
40 <empty/>
41 <!--zeroOrMore>
42 <attribute>
43 <anyName>
44 <except>
45 <nsName />
46 <nsName ns="" />
47 <name>xml:lang</name>
48 </except>
49 </anyName>
50 <text />
51 </attribute>
52 </zeroOrMore-->
53 </define>
54
55 <define name="annotated" txw:mode="inherit">
56 <doc:p>
57 This allows any number of attributes that are not in the XML Schema
58 namespace or are in no namespace, an optional id attribute of type ID,
59 and an optional annotation element. This is used as the basis for many
60 element content models.
61 </doc:p>
62 <ref name="openAttrs" />
63 <optional>
64 <attribute name="id">
65 <data type="ID" />
66 </attribute>
67 </optional>
68 <optional>
69 <ref name="annotation" />
70 </optional>
71 </define>
72
73 <define name="schemaTop" txw:mode="inline">
74 <doc:p>
75 This gives the content model of the top level of the schema.
76 </doc:p>
77 <choice>
78 <ref name="redefinable" />
79 <ref name="topLevelElement" />
80 <ref name="topLevelAttribute" />
81 <!--ref name="notation" /-->
82 </choice>
83 </define>
84
85 <define name="redefinable" txw:mode="inline">
86 <doc:p>
87 This gives the components that can be redefined within the redefine
88 element. They also occur at the top level of the schema.
89 </doc:p>
90 <choice>
91 <ref name="simpleTypeHost" />
92 <ref name="complexTypeHost" />
93 <!--ref name="namedGroup" />
94 <ref name="namedAttributeGroup" /-->
95 </choice>
96 </define>
97
98 <define name="formChoice">
99 <doc:p>
100 This gives the values for the various form attributes:
101 elementFormDefault and attributeFormDefault on the schema element, and
102 the form attributes on the element and attribute elements.
103 </doc:p>
104 <choice>
105 <value>qualified</value>
106 <value>unqualified</value>
107 </choice>
108 </define>
109
110 <!-- KK: merge the two -->
111 <define name="reducedDerivationControl">
112 <doc:p>
113 This gives the values that can be taken in the lists used to control
114 derivation by extension or restriction (this is 'reduced' derivation
115 because some derivation can involve substitution). This RELAX NG schema,
116 like the XML Schema Recommendation here, allows the keywords 'extension' and
117 'restriction' to be repeated any number of times.
118 </doc:p>
119 <list>
120 <oneOrMore>
121 <choice>
122 <value>extension</value>
123 <value>restriction</value>
124 </choice>
125 </oneOrMore>
126 </list>
127 </define>
128
129 <define name="derivationSet">
130 <doc:p>
131 This specifies the possible values for attributes that control derivation.
132 </doc:p>
133 <choice>
134 <value>#all</value>
135 <ref name="reducedDerivationControl" />
136 </choice>
137 </define>
138
139 <start>
140 <doc:p>
141 This is the beginning point for the schema, and defines the schema
142 element.
143 </doc:p>
144 <element name="schema"
145 doc:href="http://www.w3.org/TR/xmlschema-1/#element-schema">
146 <ref name="openAttrs" />
147 <zeroOrMore>
148 <choice>
149 <attribute name="version">
150 <data type="token" />
151 </attribute>
152 <attribute name="finalDefault">
153 <ref name="derivationSet" />
154 </attribute>
155 <attribute name="blockDefault">
156 <ref name="blockSet" />
157 </attribute>
158 <attribute name="attributeFormDefault">
159 <ref name="formChoice" />
160 </attribute>
161 <attribute name="elementFormDefault">
162 <ref name="formChoice" />
163 </attribute>
164 <attribute name="id">
165 <data type="ID" />
166 </attribute>
167 <attribute name="xml:lang">
168 <data type="language" />
169 </attribute>
170 <attribute name="targetNamespace">
171 <data type="anyURI" />
172 </attribute>
173 </choice>
174 </zeroOrMore>
175 <zeroOrMore>
176 <choice>
177 <!--ref name="include" /-->
178 <ref name="import" />
179 <!--ref name="redefine" /-->
180 <ref name="annotation" />
181 </choice>
182 </zeroOrMore>
183 <zeroOrMore>
184 <choice>
185 <ref name="schemaTop" />
186 <ref name="annotation" />
187 </choice>
188 </zeroOrMore>
189 </element>
190 </start>
191
192 <define name="allNNI">
193 <doc:p>
194 This gives the value type for the maxOccurs attribute, which may be a
195 non-negative number or the keyword 'unbounded'.
196 </doc:p>
197 <choice>
198 <data type="nonNegativeInteger" />
199 <value type="token">unbounded</value>
200 </choice>
201 </define>
202
203 <define name="occurs" txw:mode="inherit">
204 <doc:p>
205 This specifies the occurs attributes, minOccurs and maxOccurs, as they
206 are normally used.
207 </doc:p>
208 <zeroOrMore>
209 <choice>
210 <attribute name="minOccurs">
211 <data type="nonNegativeInteger" />
212 </attribute>
213 <attribute name="maxOccurs">
214 <ref name="allNNI" />
215 </attribute>
216 </choice>
217 </zeroOrMore>
218 </define>
219
220 <define name="typeDefParticle" txw:mode="inline">
221 <doc:p>
222 This gives the possible content of complex types.
223 </doc:p>
224 <choice>
225 <!--ref name="groupRef" /-->
226 <ref name="all" />
227 <ref name="choice" />
228 <ref name="sequence" />
229 </choice>
230 </define>
231
232 <define name="nestedParticle" txw:mode="inline">
233 <doc:p>
234 This gives the particles that can make up a model group.
235 </doc:p>
236 <choice>
237 <ref name="localElement" />
238 <!--ref name="groupRef" /-->
239 <ref name="choice" />
240 <ref name="sequence" />
241 <ref name="any" />
242 </choice>
243 </define>
244
245 <define name="fixedOrDefault" txw:mode="inline">
246 <doc:p>
247 This specifies the relationship between fixed and default attributes on
248 element and attribute elements - if one is present, then the other cannot
249 be. This is a constraint that cannot be specified using XML Schema.
250 </doc:p>
251 <choice>
252 <empty />
253 <attribute name="fixed" />
254 <attribute name="default" />
255 </choice>
256 </define>
257
258 <define name="attributeType" txw:mode="inherit">
259 <doc:p>
260 This specifies the relationship between the type attribute and the
261 simpleType element child of attribute elements - if one is present, then
262 the other cannot be, although it is possible for neither to be allowed.
263 </doc:p>
264 <choice>
265 <empty />
266 <attribute name="type">
267 <data type="QName" />
268 </attribute>
269 <ref name="simpleTypeHost" />
270 </choice>
271 </define>
272
273 <define name="localAttribute">
274 <doc:p>
275 This describes attribute elements when used in a local context. They
276 have an optional use attribute, possibly a fixed or default attribute,
277 and then can either have a ref attribute (referring to a top-level
278 attribute) or a name attribute with an optional form attribute and
279 specifying an attribute type.
280 </doc:p>
281 <element name="attribute"
282 doc:href="http://www.w3.org/TR/xmlschema-1/#element-attribute">
283 <ref name="annotated" />
284 <optional>
285 <attribute name="use">
286 <choice>
287 <value type="token">optional</value>
288 <value type="token">prohibited</value>
289 <value type="token">required</value>
290 </choice>
291 </attribute>
292 </optional>
293 <ref name="fixedOrDefault" />
294 <choice>
295 <attribute name="ref">
296 <data type="QName" />
297 </attribute>
298 <group>
299 <attribute name="name">
300 <data type="NCName" />
301 </attribute>
302 <optional>
303 <attribute name="form">
304 <ref name="formChoice" />
305 </attribute>
306 </optional>
307 <ref name="attributeType" />
308 </group>
309 </choice>
310 </element>
311 </define>
312
313 <define name="topLevelAttribute">
314 <doc:p>
315 This describes attribute elements when used at the top level of the
316 schema. They must have a name, may have a fixed or default attribute,
317 and specify their type through a type attribute or child simpleType
318 element. The name attribute of each attribute element that appears at
319 the top level of the schema is unique.
320 </doc:p>
321 <element name="attribute"
322 doc:href="http://www.w3.org/TR/xmlschema-1/#element-attribute">
323 <ref name="annotated" />
324 <attribute name="name">
325 <data type="NCName" />
326 </attribute>
327 <ref name="fixedOrDefault" />
328 <ref name="attributeType" />
329 </element>
330 </define>
331
332 <define name="attrDecls" txw:mode="inherit">
333 <doc:p>
334 This gives the model group for specifying the attributes in a complex
335 type, an extension or restriction.
336 </doc:p>
337 <zeroOrMore>
338 <choice>
339 <ref name="localAttribute" />
340 <!--ref name="attributeGroupRef" /-->
341 </choice>
342 </zeroOrMore>
343 <optional>
344 <ref name="anyAttribute" />
345 </optional>
346 </define>
347
348 <define name="anyAttribute">
349 <doc:p>
350 This specifies the anyAttribute wildcard.
351 </doc:p>
352 <element name="anyAttribute"
353 doc:href="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute">
354 <ref name="wildcard" />
355 </element>
356 </define>
357
358 <define name="complexTypeModel" txw:mode="inherit">
359 <doc:p>
360 This specifies the content of a complexType element. As children, it can
361 have a simpleContent, a complexContent or a model group. Only if it has
362 one of the latter two, may it have a mixed attribute. This latter
363 constraint is something that cannot be specified in XML Schema.
364 </doc:p>
365 <choice>
366 <ref name="simpleContent" />
367 <group>
368 <optional>
369 <attribute name="mixed">
370 <data type="boolean" />
371 </attribute>
372 </optional>
373 <choice>
374 <ref name="complexContent" />
375 <group>
376 <optional>
377 <ref name="typeDefParticle" />
378 </optional>
379 <ref name="attrDecls" />
380 </group>
381 </choice>
382 </group>
383 </choice>
384 </define>
385
386 <define name="complexTypeHost" txw:mode="inherit">
387 <ref name="typeHost" />
388 <ref name="complexType" />
389 </define>
390
391 <define name="typeHost" txw:mode="inherit"><empty/><empty/></define>
392
393 <define name="complexType" txw:mode="inherit">
394 <element name="complexType"
395 doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexType">
396 <doc:p>
397 This specifies the basic content of a complexType element.
398 </doc:p>
399 <ref name="annotated" />
400 <ref name="complexTypeModel" />
401 <optional>
402 <attribute name="name">
403 <data type="NCName" />
404 </attribute>
405 </optional>
406 <zeroOrMore>
407 <choice>
408 <attribute name="abstract">
409 <data type="boolean" />
410 </attribute>
411 <attribute name="block">
412 <ref name="derivationSet" />
413 </attribute>
414 <attribute name="final">
415 <ref name="derivationSet" />
416 </attribute>
417 </choice>
418 </zeroOrMore>
419 </element>
420 </define>
421
422 <define name="complexRestriction">
423 <doc:p>
424 This describes a restriction element within a complexContent element
425 (i.e. one that restricts a complex type). It has a base attribute, may
426 contain a model group and may contain attribute declarations of various
427 sorts.
428 </doc:p>
429 <element name="restriction"
430 doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent::restriction">
431 <ref name="annotated" />
432 <attribute name="base">
433 <data type="QName" />
434 </attribute>
435 <optional>
436 <ref name="typeDefParticle" />
437 </optional>
438 <ref name="attrDecls" />
439 </element>
440 </define>
441
442 <define name="extensionType">
443 <doc:p>
444 This specifies the basic model for an extension element: adding a
445 required base attribute to the model used for most components.
446 </doc:p>
447 <ref name="annotated" />
448 <attribute name="base">
449 <data type="QName" />
450 </attribute>
451 </define>
452
453 <define name="complexExtension">
454 <doc:p>
455 This describes an extension element within a complexContent element
456 (i.e. one that restricts a complex type). It may contain a model group
457 and may contain attribute declarations of various sorts.
458 </doc:p>
459 <element name="extension"
460 doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent::extension">
461 <ref name="extensionType" />
462 <optional>
463 <ref name="typeDefParticle" />
464 </optional>
465 <ref name="attrDecls" />
466 </element>
467 </define>
468
469 <define name="complexContent">
470 <doc:p>
471 This describes a complexContent element. It may have a mixed attribute,
472 and either a restriction or extension element as content.
473 </doc:p>
474 <element name="complexContent"
475 doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent">
476 <ref name="annotated" />
477 <optional>
478 <attribute name="mixed">
479 <data type="boolean" />
480 </attribute>
481 </optional>
482 <choice>
483 <ref name="complexRestriction" />
484 <ref name="complexExtension" />
485 </choice>
486 </element>
487 </define>
488
489 <define name="simpleRestriction">
490 <doc:p>
491 This describes a restriction element that appears within a simpleContent
492 or simpleType element (i.e. one that restricts a simple type). Its
493 content follows the simple restriction model that is detailed below, and
494 may include attribute declarations.
495 </doc:p>
496 <element name="restriction"
497 doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent::restriction">
498 <ref name="annotated" />
499 <ref name="simpleRestrictionModel" />
500 <ref name="attrDecls" />
501 </element>
502 </define>
503
504 <define name="simpleExtension">
505 <doc:p>
506 This describes an extension element that appears within a simpleContent
507 element (i.e. one that extends a simple type). Like other extensions, it
508 has a base type, but it can only be used to add attributes.
509 </doc:p>
510 <element name="extension"
511 doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent::extension">
512 <ref name="extensionType" />
513 <ref name="attrDecls" />
514 </element>
515 </define>
516
517 <define name="simpleContent">
518 <doc:p>
519 This describes a simpleContent element, whose content can either hold a
520 restriction or extension element.
521 </doc:p>
522 <element name="simpleContent"
523 doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent">
524 <ref name="annotated" />
525 <choice>
526 <ref name="simpleRestriction" />
527 <ref name="simpleExtension" />
528 </choice>
529 </element>
530 </define>
531
532 <define name="blockSet">
533 <doc:p>
534 This gives the possible values for block attributes on element elements,
535 which includes substitution amongst the list of possible values. This
536 RELAX NG schema, like the XML Schema Recommendation, allows each of the
537 keywords 'extension', 'restriction' and 'substitution' to occur more than
538 once within the list.
539 </doc:p>
540 <choice>
541 <value type="token">#all</value>
542 <list>
543 <oneOrMore>
544 <choice>
545 <value>extension</value>
546 <value>restriction</value>
547 <value>substitution</value>
548 </choice>
549 </oneOrMore>
550 </list>
551 </choice>
552 </define>
553
554 <define name="element" txw:mode="inherit">
555 <doc:p>
556 This describes the basic content model of an element element. It is
557 annotated, may have a fixed or default attribute, and may have nillable
558 and/or block attributes. Its type may be specified through a type
559 attribute, a local simple type or a local complex type - the choice
560 between these methods is something that cannot be indicated with XML
561 Schema. This content is optionally followed by some identify constraints.
562 </doc:p>
563 <ref name="annotated" />
564 <ref name="fixedOrDefault" />
565 <zeroOrMore>
566 <choice>
567 <attribute name="nillable">
568 <data type="boolean" />
569 </attribute>
570 <attribute name="block">
571 <ref name="blockSet" />
572 </attribute>
573 </choice>
574 </zeroOrMore>
575 <choice>
576 <empty />
577 <attribute name="type">
578 <data type="QName" />
579 </attribute>
580 <ref name="simpleTypeHost" />
581 <ref name="complexTypeHost" />
582 </choice>
583 <!--zeroOrMore>
584 <ref name="identityConstraint" />
585 </zeroOrMore-->
586 </define>
587
588 <define name="topLevelElement">
589 <doc:p>
590 This describes an element element that appears at the top level of the
591 schema. On top of the basic content for an element element, it has to
592 have a name, which is a unique identifier in the element symbol space. It
593 may have substitutionGroup, abstract and/or final attributes.
594 </doc:p>
595 <element name="element"
596 doc:href="http://www.w3.org/TR/xmlschema-1/#element-element">
597 <ref name="element" />
598 <attribute name="name">
599 <data type="NCName" />
600 </attribute>
601 <zeroOrMore>
602 <choice>
603 <attribute name="substitutionGroup">
604 <data type="QName" />
605 </attribute>
606 <attribute name="abstract">
607 <data type="boolean" />
608 </attribute>
609 <attribute name="final">
610 <ref name="derivationSet" />
611 </attribute>
612 </choice>
613 </zeroOrMore>
614 </element>
615 </define>
616
617 <define name="localElement">
618 <doc:p>
619 This describes an element element that appears locally, within a
620 complexType or group element. It may have minOccurs and/or maxOccurs
621 attributes. If it has a ref attribute, then that&apos;s all it can
622 have. Otherwise, it must have a name and specifies its type in the same
623 way as the basic element content model described above. It may in this
624 case also have a form element. These constraints on local elements
625 cannot be described within XML Schema.
626 </doc:p>
627 <element name="element"
628 doc:href="http://www.w3.org/TR/xmlschema-1/#element-element">
629 <ref name="occurs" />
630 <choice>
631 <attribute name="ref">
632 <data type="QName" />
633 </attribute>
634 <group>
635 <ref name="element" />
636 <attribute name="name">
637 <data type="NCName" />
638 </attribute>
639 <optional>
640 <attribute name="form">
641 <ref name="formChoice" />
642 </attribute>
643 </optional>
644 </group>
645 </choice>
646 </element>
647 </define>
648
649 <!--define name="namedGroup">
650 <doc:p>
651 This describes an group element that appears at the top level of the
652 schema. It must have a name attribute, and must have one of an all,
653 choice or sequence element child.
654 </doc:p>
655 <element name="group"
656 doc:href="http://www.w3.org/TR/xmlschema-1/#element-group">
657 <ref name="annotated" />
658 <attribute name="name">
659 <data type="NCName" />
660 </attribute>
661 <choice>
662 <element name="all">
663 <ref name="simpleExplicitGroup" /> <!- - RS - relaxed all content model - ->
664 </element>
665 <element name="choice">
666 <ref name="simpleExplicitGroup" />
667 </element>
668 <element name="sequence">
669 <ref name="simpleExplicitGroup" />
670 </element>
671 </choice>
672 </element>
673 </define-->
674
675 <!--define name="groupRef">
676 <doc:p>
677 This describes group element that occurs locally, referring to a
678 top-level named group. It may have occurrence attributes, and must have
679 a ref attribute.
680 </doc:p>
681 <element name="group"
682 doc:href="http://www.w3.org/TR/xmlschema-1/#element-group">
683 <ref name="annotated" />
684 <ref name="occurs" />
685 <attribute name="ref">
686 <data type="QName" />
687 </attribute>
688 </element>
689 </define-->
690
691 <define name="explicitGroup" txw:mode="inherit">
692 <doc:p>
693 This gives the content of a model group (not a group element) in the
694 normal run of things. It has occurrence attributes and any number of
695 particles within it.
696 </doc:p>
697 <ref name="annotated" />
698 <ref name="occurs" />
699 <zeroOrMore>
700 <ref name="nestedParticle" />
701 </zeroOrMore>
702 </define>
703
704 <define name="simpleExplicitGroup">
705 <doc:p>
706 This gives the content of a model group (not a group element) within a
707 named group - it differs from the above in that it doesn&apos;t have any
708 occurrence attributes.
709 </doc:p>
710 <ref name="annotated" />
711 <zeroOrMore>
712 <ref name="nestedParticle" />
713 </zeroOrMore>
714 </define>
715
716 <define name="all">
717 <doc:p>
718 This describes an all element that appears outside a named group (i.e. as
719 the content of a complexType element). It has the standard model for an
720 all element, but adds minOccurs and maxOccurs attributes which can only
721 take certain values.
722 </doc:p>
723 <element name="all"
724 doc:href="http://www.w3.org/TR/xmlschema-1/#element-all">
725 <ref name="explicitGroup" />
726 </element>
727 </define>
728
729 <define name="choice">
730 <doc:p>
731 This describes a choice element that appears outside a named group.
732 </doc:p>
733 <element name="choice"
734 doc:href="http://www.w3.org/TR/xmlschema-1/#element-choice">
735 <ref name="explicitGroup" />
736 </element>
737 </define>
738
739 <define name="sequence">
740 <doc:p>
741 This describes a sequence element that appears outside a named group.
742 </doc:p>
743 <element name="sequence"
744 doc:href="http://www.w3.org/TR/xmlschema-1/#element-sequence">
745 <ref name="explicitGroup" />
746 </element>
747 </define>
748
749 <define name="wildcard" txw:mode="inherit">
750 <doc:p>
751 This describes a wildcard element (i.e. any or anyAttribute). The
752 namespace attribute can take a list URIs interspersed with the keywords
753 '##targetNamespace' and/or '##local'. This RELAX NG schema, like the XML
754 Schema Recommendation, allows the keywords to be specified more than once
755 each within the list, if they&apos;re given. This model also specifies the
756 processContents attribute.
757 </doc:p>
758 <ref name="annotated" />
759 <zeroOrMore>
760 <choice>
761 <attribute name="namespace">
762 <choice>
763 <value type="token">##any</value>
764 <value type="token">##other</value>
765 <list>
766 <zeroOrMore>
767 <choice>
768 <data type="anyURI" />
769 <value>##targetNamespace</value>
770 <value>##local</value>
771 </choice>
772 </zeroOrMore>
773 </list>
774 </choice>
775 </attribute>
776 <attribute name="processContents">
777 <choice>
778 <value type="token">lax</value>
779 <value type="token">skip</value>
780 <value type="token">strict</value>
781 </choice>
782 </attribute>
783 </choice>
784 </zeroOrMore>
785 </define>
786
787 <define name="any">
788 <doc:p>
789 This describes an any element as a wildcard.
790 </doc:p>
791 <element name="any"
792 doc:href="http://www.w3.org/TR/xmlschema-1/#element-any">
793 <ref name="wildcard" />
794 <ref name="occurs" />
795 </element>
796 </define>
797
798 <!--define name="namedAttributeGroup">
799 <doc:p>
800 This describes an attributeGroup element as it appears at the top level
801 of the schema. It must have a name attribute, and then contains
802 attribute declarations.
803 </doc:p>
804 <element name="attributeGroup"
805 doc:href="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup">
806 <ref name="annotated" />
807 <attribute name="name">
808 <data type="NCName" />
809 </attribute>
810 <ref name="attrDecls" />
811 </element>
812 </define-->
813
814 <!--define name="attributeGroupRef">
815 <doc:p>
816 This describes an attributeGroup element as it appears within a complex
817 type. It must have a ref attribute.
818 </doc:p>
819 <element name="attributeGroup"
820 doc:href="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup">
821 <ref name="annotated" />
822 <attribute name="ref">
823 <data type="QName" />
824 </attribute>
825 </element>
826 </define-->
827
828 <!--define name="include">
829 <doc:p>
830 This describes an include element, which must have a schemaLocation
831 attribute.
832 </doc:p>
833 <element name="include"
834 doc:href="http://www.w3.org/TR/xmlschema-1/#element-include">
835 <ref name="annotated" />
836 <attribute name="schemaLocation">
837 <data type="anyURI" />
838 </attribute>
839 </element>
840 </define-->
841
842 <!--define name="redefine">
843 <doc:p>
844 This describes a redefine element, which must have a schemaLocation
845 attribute and can then contain any mix of annotations and redefinable
846 components.
847 </doc:p>
848 <element name="redefine"
849 doc:href="http://www.w3.org/TR/xmlschema-1/#element-redefine">
850 <ref name="openAttrs" />
851 <optional>
852 <attribute name="id">
853 <data type="ID" />
854 </attribute>
855 </optional>
856 <attribute name="schemaLocation">
857 <data type="anyURI" />
858 </attribute>
859 <zeroOrMore>
860 <choice>
861 <ref name="annotation" />
862 <ref name="redefinable" />
863 </choice>
864 </zeroOrMore>
865 </element>
866 </define-->
867
868 <define name="import">
869 <doc:p>
870 This describes an import element that&apos;s used when its parent schema
871 element specifies a targetNamespace. In these cases, the namespace
872 attribute on the import element is optional.
873 </doc:p>
874 <element name="import"
875 doc:href="http://www.w3.org/TR/xmlschema-1/#element-import">
876 <ref name="annotated" />
877 <optional>
878 <attribute name="schemaLocation">
879 <data type="anyURI" />
880 </attribute>
881 </optional>
882 <optional>
883 <attribute name="namespace">
884 <data type="anyURI" />
885 </attribute>
886 </optional>
887 </element>
888 </define>
889
890 <!--define name="selector">
891 <doc:p>
892 This describes a selector element. The xpath attribute is a simplified
893 XPath - the regular expression given here is the one from the XML Schema
894 for XML Schema.
895 </doc:p>
896 <element name="selector"
897 doc:href="http://www.w3.org/TR/xmlschema-1/#element-selector">
898 <ref name="annotated" />
899 <attribute name="xpath">
900 <data type="token">
901 <param name="pattern">(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*</param>
902 </data>
903 </attribute>
904 </element>
905 </define>
906
907 <define name="field">
908 <doc:p>
909 This describes a field element. The xpath attribute is a simplified
910 XPath - the regular expression given here is the one from the XML Schema
911 for XML Schema.
912 </doc:p>
913 <element name="field"
914 doc:href="http://www.w3.org/TR/xmlschema-1/#element-field">
915 <ref name="annotated" />
916 <attribute name="xpath">
917 <data type="token">
918 <param name="pattern">(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*</param>
919 </data>
920 </attribute>
921 </element>
922 </define>
923
924 <define name="keybase" txw:mode="inherit">
925 <doc:p>
926 This gives the basic content for identity constraints - a name attribute
927 that uniquely identifies the identity constraint, a selector element and
928 one or more field elements.
929 </doc:p>
930 <ref name="annotated" />
931 <attribute name="name">
932 <data type="NCName" />
933 </attribute>
934 <ref name="selector" />
935 <oneOrMore>
936 <ref name="field" />
937 </oneOrMore>
938 </define>
939
940 <define name="identityConstraint" txw:mode="inline">
941 <doc:p>
942 This gives a model group for the three identity constraint elements, used
943 within the content of element elements.
944 </doc:p>
945 <choice>
946 <ref name="unique" />
947 <ref name="key" />
948 <ref name="keyref" />
949 </choice>
950 </define>
951
952 <define name="unique">
953 <doc:p>
954 This describes a unique element.
955 </doc:p>
956 <element name="unique"
957 doc:href="http://www.w3.org/TR/xmlschema-1/#element-unique">
958 <ref name="keybase" />
959 </element>
960 </define>
961
962 <define name="key">
963 <doc:p>
964 This describes a key element.
965 </doc:p>
966 <element name="key"
967 doc:href="http://www.w3.org/TR/xmlschema-1/#element-key">
968 <ref name="keybase" />
969 </element>
970 </define>
971
972 <define name="keyref">
973 <doc:p>
974 This describes a keyref element.
975 </doc:p>
976 <element name="keyref"
977 doc:href="http://www.w3.org/TR/xmlschema-1/#element-keyref">
978 <ref name="keybase" />
979 <attribute name="refer">
980 <data type="QName" />
981 </attribute>
982 </element>
983 </define-->
984
985 <!--define name="notation">
986 <doc:p>
987 This describes a notation element. The names of notation elements are
988 unique in the notation symbol space. The public attribute is required,
989 and the system attribute is optional.
990 </doc:p>
991 <element name="notation"
992 doc:href="http://www.w3.org/TR/xmlschema-1/#element-notation">
993 <ref name="annotated" />
994 <attribute name="name">
995 <data type="NCName" />
996 </attribute>
997 <attribute name="public">
998 <data type="token" />
999 </attribute>
1000 <optional>
1001 <attribute name="system">
1002 <data type="anyURI" />
1003 </attribute>
1004 </optional>
1005 </element>
1006 </define-->
1007
1008 <define name="appinfoContent">
1009 <doc:p>
1010 This is designed to describe the content of the appinfo elements in the
1011 schema. At the moment this allows any mixed content without validation.
1012 Note that this is fairly complex compared to the XML Schema equivalent,
1013 which would be a single any element.
1014 </doc:p>
1015 <ref name="anyContent" />
1016 </define>
1017
1018 <define name="anyContent">
1019 <empty/> <!-- KK don't care -->
1020 <!--mixed>
1021 <zeroOrMore>
1022 <element>
1023 <anyName />
1024 <zeroOrMore>
1025 <attribute>
1026 <anyName />
1027 </attribute>
1028 </zeroOrMore>
1029 <ref name="anyContent" />
1030 <empty />
1031 </element>
1032 </zeroOrMore>
1033 </mixed-->
1034 </define>
1035
1036 <define name="appinfo">
1037 <doc:p>
1038 This describes an appinfo element. It has an optional source attribute
1039 and can currently contain anything at all.
1040 </doc:p>
1041 <element name="appinfo"
1042 doc:href="http://www.w3.org/TR/xmlschema-1/#element-appinfo">
1043 <optional>
1044 <attribute name="source">
1045 <data type="anyURI" />
1046 </attribute>
1047 </optional>
1048 <ref name="appinfoContent" />
1049 </element>
1050 </define>
1051
1052 <define name="documentationContent">
1053 <doc:p>
1054 This is designed to describe the content of the documentation elements in
1055 the schema. At the moment this allows any mixed content without
1056 validation. Note that this is fairly complex compared to the XML Schema
1057 equivalent, which would be a single any element.
1058 </doc:p>
1059 <ref name="anyContent" />
1060 </define>
1061
1062 <define name="documentation">
1063 <doc:p>
1064 This describes a documentation element. It has optional source
1065 and xml:lang attributes and can currently contain anything at all.
1066 </doc:p>
1067 <element name="documentation"
1068 doc:href="http://www.w3.org/TR/xmlschema-1/#element-documentation">
1069 <zeroOrMore>
1070 <choice>
1071 <attribute name="source">
1072 <data type="anyURI" />
1073 </attribute>
1074 <attribute name="xml:lang">
1075 <data type="language" />
1076 </attribute>
1077 </choice>
1078 </zeroOrMore>
1079 <ref name="documentationContent" />
1080 </element>
1081 </define>
1082
1083 <define name="annotation">
1084 <doc:p>
1085 This describes an annotation element. It can have any attributes, may
1086 have an id attribute, and contains any number of documentation or appinfo
1087 elements.
1088 </doc:p>
1089 <element name="annotation"
1090 doc:href="http://www.w3.org/TR/xmlschema-1/#element-annotation">
1091 <ref name="openAttrs" />
1092 <optional>
1093 <attribute name="id">
1094 <data type="ID" />
1095 </attribute>
1096 </optional>
1097 <zeroOrMore>
1098 <choice>
1099 <ref name="documentation" />
1100 <ref name="appinfo" />
1101 </choice>
1102 </zeroOrMore>
1103 </element>
1104 </define>
1105
1106 <define name="simpleDerivation" txw:mode="inline">
1107 <doc:p>
1108 This gives the various types of derivation of simple types.
1109 </doc:p>
1110 <choice>
1111 <ref name="simpleRestriction" />
1112 <ref name="list" />
1113 <ref name="union" />
1114 </choice>
1115 </define>
1116
1117 <define name="simpleDerivationSet">
1118 <doc:p>
1119 This specifies the values of the final attribute for simple types. This
1120 RELAX NG schema for XML Schema, like the XML Schema Recommendation, allows
1121 the keywords 'list', 'union' and 'restriction' to appear more than once
1122 within the list.
1123 </doc:p>
1124 <choice>
1125 <value type="token">#all</value>
1126 <list>
1127 <zeroOrMore>
1128 <choice>
1129 <value>list</value>
1130 <value>union</value>
1131 <value>restriction</value>
1132 </choice>
1133 </zeroOrMore>
1134 </list>
1135 </choice>
1136 </define>
1137
1138 <define name="simpleTypeHost" txw:mode="inherit">
1139 <ref name="typeHost" />
1140 <ref name="simpleType" />
1141 </define>
1142
1143 <define name="simpleType" txw:mode="inherit">
1144 <doc:p>
1145 This gives the basic content of a simple type.
1146 </doc:p>
1147 <element name="simpleType"
1148 doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleType">
1149 <ref name="annotated" />
1150 <ref name="simpleDerivation" />
1151 <optional>
1152 <attribute name="name">
1153 <data type="NCName" />
1154 </attribute>
1155 </optional>
1156 <optional>
1157 <attribute name="final">
1158 <ref name="simpleDerivationSet" />
1159 </attribute>
1160 </optional>
1161 </element>
1162 </define>
1163
1164 <!--define name="rangeFacets" txw:mode="inherit">
1165 <doc:p>
1166 This describes the relationship between the various range facets. Only
1167 one of minExclusive and minInclusive can be present, and only one of
1168 maxExclusive and maxInclusive can be present. This is a constraint that
1169 can&apos;t easily be expressed using XML Schema. This RELAX NG schema
1170 for XML Schema is a little more restrictive than the XML Schema
1171 Recommendation in that it also forces there to be a maximum of one of
1172 each of these types of facets.
1173 </doc:p>
1174 <interleave>
1175 <optional>
1176 <choice>
1177 <ref name="minExclusive" />
1178 <ref name="minInclusive" />
1179 </choice>
1180 </optional>
1181 <optional>
1182 <choice>
1183 <ref name="maxExclusive" />
1184 <ref name="maxInclusive" />
1185 </choice>
1186 </optional>
1187 </interleave>
1188 </define>
1189
1190 <define name="digitFacets" txw:mode="inherit">
1191 <doc:p>
1192 This specifies optional totalDigits and fractionDigits elements. This
1193 RELAX NG schema for XML Schema is a little more restrictive than the XML
1194 Schema Recommendation in that it also forces there to be a maximum of one
1195 of each of these types of facets.
1196 </doc:p>
1197 <optional>
1198 <ref name="totalDigits" />
1199 </optional>
1200 <optional>
1201 <ref name="fractionDigits" />
1202 </optional>
1203 </define>
1204
1205 <define name="lengthFacets" txw:mode="inherit">
1206 <doc:p>
1207 This specifies optional length, minLength and maxLength elements. This
1208 RELAX NG schema for XML Schema is a little more restrictive than the XML
1209 Schema Recommendation in that it also forces there to be a maximum of one
1210 of each of these types of facets, and says that if a length element is
1211 given, then neither minLength nor maxLength should be present.
1212 </doc:p>
1213 <choice>
1214 <ref name="length" />
1215 <interleave>
1216 <optional>
1217 <ref name="minLength" />
1218 </optional>
1219 <optional>
1220 <ref name="maxLength" />
1221 </optional>
1222 </interleave>
1223 </choice>
1224 </define>
1225
1226 <define name="commonFacets" txw:mode="inherit">
1227 <doc:p>
1228 This specifies zero or more enumeration or pattern elements and an
1229 optional whiteSpace element. This RELAX NG schema for XML Schema is a
1230 little more restrictive than the XML Schema Recommendation in that it
1231 also forces there to be a maximum of one whiteSpace element within the
1232 facets. Note that the whiteSpace facet is constrained to have a value of
1233 'collapse'.
1234 </doc:p>
1235 <zeroOrMore>
1236 <ref name="enumeration" />
1237 </zeroOrMore>
1238 <optional>
1239 <ref name="whiteSpaceCollapse" />
1240 </optional>
1241 <zeroOrMore>
1242 <ref name="pattern" />
1243 </zeroOrMore>
1244 </define-->
1245
1246 <define name="simpleRestrictionModel">
1247 <doc:p>
1248 This specifies the types of facets that are valid in restrictions on the
1249 built-in data types. This can only perform rudimentary checking, but
1250 should be enough in most circumstances. Note that for xs:anySimpleType
1251 and xs:string, the whiteSpace facet can take any value, for
1252 xs:normalizedString it can be 'replace' or 'collapse', and for all other
1253 built-in types it has to be 'collapse'.
1254 </doc:p>
1255 <choice>
1256 <attribute name="base">
1257 <data type="QName" />
1258 </attribute>
1259 <ref name="simpleTypeHost" />
1260 </choice>
1261 <interleave>
1262 <!--ref name="rangeFacets" />
1263 <ref name="digitFacets" />
1264 <ref name="lengthFacets" />
1265 <optional>
1266 <ref name="whiteSpace" />
1267 </optional-->
1268 <zeroOrMore>
1269 <ref name="enumeration" />
1270 </zeroOrMore>
1271 <!--zeroOrMore>
1272 <ref name="pattern" />
1273 </zeroOrMore-->
1274 </interleave>
1275 </define>
1276
1277 <define name="list">
1278 <doc:p>
1279 This describes a list element. It can either specify a local simple type
1280 or have a itemType attribute. This constraint cannot be expressed in XML
1281 Schema.
1282 </doc:p>
1283 <element name="list"
1284 doc:href="http://www.w3.org/TR/xmlschema-1/#element-list">
1285 <ref name="annotated" />
1286 <choice>
1287 <ref name="simpleTypeHost" />
1288 <attribute name="itemType">
1289 <data type="QName" />
1290 </attribute>
1291 </choice>
1292 </element>
1293 </define>
1294
1295 <define name="union">
1296 <doc:p>
1297 This describes a union element. If the memberTypes attribute is missing
1298 or empty, then it must contain one or more simpleType elements; if
1299 it&apos;s present, then it can contain simpleType elements or list simple
1300 types in the memberTypes attribute. This constraint cannot be expressed
1301 in XML Schema.
1302 </doc:p>
1303 <element name="union"
1304 doc:href="http://www.w3.org/TR/xmlschema-1/#element-union">
1305 <ref name="annotated" />
1306 <choice>
1307 <group>
1308 <attribute name="memberTypes">
1309 <list>
1310 <oneOrMore>
1311 <data type="QName" />
1312 </oneOrMore>
1313 </list>
1314 </attribute>
1315 <zeroOrMore>
1316 <ref name="simpleTypeHost" />
1317 </zeroOrMore>
1318 </group>
1319 <group>
1320 <optional>
1321 <attribute name="memberTypes">
1322 <empty />
1323 </attribute>
1324 </optional>
1325 <oneOrMore>
1326 <ref name="simpleTypeHost" />
1327 </oneOrMore>
1328 </group>
1329 </choice>
1330 </element>
1331 </define>
1332
1333 <define name="facet" txw:mode="inherit">
1334 <doc:p>
1335 This is the basic content of a facet. It has an optional fixed attribute.
1336 </doc:p>
1337 <ref name="annotated" />
1338 <optional>
1339 <attribute name="fixed">
1340 <data type="boolean" />
1341 </attribute>
1342 </optional>
1343 </define>
1344
1345 <define name="noFixedFacet" txw:mode="inherit">
1346 <doc:p>
1347 This is the content of a facet that cannot be fixed (enumeration or
1348 pattern). It has a value attribute that can take any kind of value.
1349 </doc:p>
1350 <ref name="annotated" />
1351 <attribute name="value" />
1352 </define>
1353
1354 <!--define name="rangeFacet">
1355 <doc:p>
1356 This is the content of a range facet. The value must be one of the data
1357 types shown (as these are the only types of data that accept ranges). I
1358 haven&apos;t gone so far as to indicate the data type of the value
1359 attribute of a range facet according to the base type as this would be
1360 very complicated (although it would be possible in RELAX NG).
1361 </doc:p>
1362 <ref name="facet" />
1363 <attribute name="value">
1364 <choice>
1365 <data type="decimal" />
1366 <data type="float" />
1367 <data type="double" />
1368 <data type="duration" />
1369 <data type="dateTime" />
1370 <data type="time" />
1371 <data type="date" />
1372 <data type="gYearMonth" />
1373 <data type="gYear" />
1374 <data type="gMonthDay" />
1375 <data type="gMonth" />
1376 <data type="gDay" />
1377 </choice>
1378 </attribute>
1379 </define>
1380
1381 <define name="minExclusive">
1382 <doc:p>
1383 This describes a minExclusive element.
1384 </doc:p>
1385 <element name="minExclusive"
1386 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minExclusive">
1387 <ref name="rangeFacet" />
1388 </element>
1389 </define>
1390
1391 <define name="minInclusive">
1392 <doc:p>
1393 This describes a minInclusive element.
1394 </doc:p>
1395 <element name="minInclusive"
1396 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minInclusive">
1397 <ref name="rangeFacet" />
1398 </element>
1399 </define>
1400
1401 <define name="maxExclusive">
1402 <doc:p>
1403 This describes a maxExclusive element.
1404 </doc:p>
1405 <element name="maxExclusive"
1406 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxExclusive">
1407 <ref name="rangeFacet" />
1408 </element>
1409 </define>
1410
1411 <define name="maxInclusive">
1412 <doc:p>
1413 This describes a maxInclusive element.
1414 </doc:p>
1415 <element name="maxInclusive"
1416 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxInclusive">
1417 <ref name="rangeFacet" />
1418 </element>
1419 </define>
1420
1421 <define name="numFacet">
1422 <doc:p>
1423 This is the content of a numerical facet.
1424 </doc:p>
1425 <ref name="facet" />
1426 <attribute name="value">
1427 <data type="nonNegativeInteger" />
1428 </attribute>
1429 </define>
1430
1431 <define name="totalDigits">
1432 <doc:p>
1433 This describes a totalDigits element. The value attribute must take a
1434 positive integer.
1435 </doc:p>
1436 <element name="totalDigits"
1437 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-totalDigits">
1438 <ref name="facet" />
1439 <attribute name="value">
1440 <data type="positiveInteger" />
1441 </attribute>
1442 </element>
1443 </define>
1444
1445 <define name="fractionDigits">
1446 <doc:p>
1447 This describes a fractionDigits element.
1448 </doc:p>
1449 <element name="fractionDigits"
1450 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-fractionDigits">
1451 <ref name="numFacet" />
1452 </element>
1453 </define>
1454
1455 <define name="length">
1456 <doc:p>
1457 This describes a length element.
1458 </doc:p>
1459 <element name="length"
1460 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-length">
1461 <ref name="numFacet" />
1462 </element>
1463 </define>
1464
1465 <define name="minLength">
1466 <doc:p>
1467 This describes a minLength element.
1468 </doc:p>
1469 <element name="minLength"
1470 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minLength">
1471 <ref name="numFacet" />
1472 </element>
1473 </define>
1474
1475 <define name="maxLength">
1476 <doc:p>
1477 This describes a maxLength element.
1478 </doc:p>
1479 <element name="maxLength"
1480 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxLength">
1481 <ref name="numFacet" />
1482 </element>
1483 </define-->
1484
1485 <define name="enumeration">
1486 <doc:p>
1487 This describes an enumeration element.
1488 </doc:p>
1489 <element name="enumeration"
1490 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-enumeration">
1491 <ref name="noFixedFacet" />
1492 </element>
1493 </define>
1494
1495 <!--define name="whiteSpace">
1496 <doc:p>
1497 This describes a whiteSpace element that can take any of the permitted
1498 values.
1499 </doc:p>
1500 <element name="whiteSpace"
1501 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
1502 <ref name="facet" />
1503 <attribute name="value">
1504 <choice>
1505 <value type="token">preserve</value>
1506 <value type="token">replace</value>
1507 <value type="token">collapse</value>
1508 </choice>
1509 </attribute>
1510 </element>
1511 </define>
1512
1513 <define name="whiteSpaceReplaceOrCollapse">
1514 <doc:p>
1515 This describes a whiteSpace element that can only take the values
1516 'replace' or 'collapse'.
1517 </doc:p>
1518 <element name="whiteSpace"
1519 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
1520 <ref name="facet" />
1521 <attribute name="value">
1522 <choice>
1523 <value type="token">replace</value>
1524 <value type="token">collapse</value>
1525 </choice>
1526 </attribute>
1527 </element>
1528 </define>
1529
1530 <define name="whiteSpaceCollapse">
1531 <doc:p>
1532 This describes a whiteSpace element that can only take the value
1533 'collapse'.
1534 </doc:p>
1535 <element name="whiteSpace"
1536 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
1537 <ref name="facet" />
1538 <attribute name="value">
1539 <value type="token">collapse</value>
1540 </attribute>
1541 </element>
1542 </define>
1543
1544 <define name="pattern">
1545 <doc:p>
1546 This describes a pattern element.
1547 </doc:p>
1548 <element name="pattern"
1549 doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-pattern">
1550 <ref name="noFixedFacet" />
1551 </element>
1552 </define-->
1553
1554 </grammar>