summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-03-18 23:33:43 +0100
committerMichał Górny <mgorny@gentoo.org>2016-03-18 23:33:43 +0100
commit7a3fe56cba7233fec72a7303e20a5c99d9965de9 (patch)
tree071451c31dea58985418aa2f68fe2cb1b51ad318 /projects.xsd
parentrepositories: Ensure there is at most one <homepage/> (diff)
downloadxml-schema-7a3fe56cba7233fec72a7303e20a5c99d9965de9.tar.gz
xml-schema-7a3fe56cba7233fec72a7303e20a5c99d9965de9.tar.bz2
xml-schema-7a3fe56cba7233fec72a7303e20a5c99d9965de9.zip
projects: Allow any order of elements, add keys to restrict repetitions
Diffstat (limited to 'projects.xsd')
-rw-r--r--projects.xsd32
1 files changed, 18 insertions, 14 deletions
diff --git a/projects.xsd b/projects.xsd
index 9f12329..e6f778b 100644
--- a/projects.xsd
+++ b/projects.xsd
@@ -15,23 +15,27 @@
<xs:selector xpath='project/subproject'/>
<xs:field xpath='@ref'/>
</xs:keyref>
+ <!-- define additional keys to enforce exactly one element
+ of each kind -->
+ <xs:key name='projectNameKey'>
+ <xs:selector xpath='project'/>
+ <xs:field xpath='name'/>
+ </xs:key>
+ <xs:key name='projectURLKey'>
+ <xs:selector xpath='project'/>
+ <xs:field xpath='url'/>
+ </xs:key>
</xs:element>
<xs:complexType name='projectType'>
- <xs:sequence>
- <xs:element name='email' type='emailType'
- minOccurs='1' maxOccurs='1'/>
- <xs:element name='name' type='xs:token'
- minOccurs='0' maxOccurs='1'/>
- <xs:element name='url' type='urlType'
- minOccurs='0' maxOccurs='1'/>
- <xs:element name='description' type='xs:token'
- minOccurs='0' maxOccurs='1'/>
- <xs:element name='subproject' type='subprojectType'
- minOccurs='0' maxOccurs='unbounded'/>
- <xs:element name='member' type='memberType'
- minOccurs='0' maxOccurs='unbounded'/>
- </xs:sequence>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='email' type='emailType'/>
+ <xs:element name='name' type='xs:token'/>
+ <xs:element name='url' type='urlType'/>
+ <xs:element name='description' type='xs:token'/>
+ <xs:element name='subproject' type='subprojectType'/>
+ <xs:element name='member' type='memberType'/>
+ </xs:choice>
</xs:complexType>
<xs:complexType name='subprojectType'>