summaryrefslogtreecommitdiff
blob: e6f778bd19ba5af364b34a56f317eeee6680b8aa (plain)
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
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
	<xs:element name='projects'>
		<xs:complexType>
			<xs:choice minOccurs='0' maxOccurs='unbounded'>
				<xs:element name='project' type='projectType'/>
			</xs:choice>
		</xs:complexType>
		<xs:key name='projectKey'>
			<xs:selector xpath='project'/>
			<xs:field xpath='email'/>
		</xs:key>
		<xs:keyref name='subprojectRef' refer='projectKey'>
			<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: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'>
		<xs:attribute name='inherit-members' type='numericBoolType'/>
		<xs:attribute name='ref' type='projectRefType'/>
	</xs:complexType>

	<xs:simpleType name='projectRefType'>
		<xs:restriction base='emailType'>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name='memberType'>
		<xs:all>
			<xs:element name='email' type='emailType'
				minOccurs='1' maxOccurs='1'/>
			<xs:element name='name' type='xs:token'
				minOccurs='0' maxOccurs='1'/>
			<xs:element name='role' type='xs:token'
				minOccurs='0' maxOccurs='1'/>
		</xs:all>
		<xs:attribute name='is-lead' type='numericBoolType'/>
	</xs:complexType>

	<!-- generic types -->
	<xs:simpleType name='emailType'>
		<xs:restriction base='xs:token'>
			<!-- minimal safe regex -->
			<xs:pattern value="[^@]+@[^.]+\..+"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='urlType'>
		<xs:restriction base='xs:token'>
			<!-- TODO: something better? -->
			<xs:pattern value="(mailto:[^@]+@[^.]+\..+|https?://.+)"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='numericBoolType'>
		<xs:restriction base='xs:integer'>
			<xs:minInclusive value='0'/>
			<xs:maxInclusive value='1'/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>