commit: 9de0e83fb8bc56c8e2db187e6bc66dc85cce9afa
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 17:27:08 2016 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 16 17:27:08 2016 +0000
URL: https://gitweb.gentoo.org/data/xml-schema.git/commit/?id=9de0e83f
metadata: Use more portable fake-attr uniquity constraint for subslots
metadata.xsd | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/metadata.xsd b/metadata.xsd
index 493c930..0ead09e 100644
--- a/metadata.xsd
+++ b/metadata.xsd
@@ -51,6 +51,10 @@
<xs:selector xpath='slot'/>
<xs:field xpath='@name'/>
</xs:unique>
+ <xs:unique name='subslotsSingleConstraint'>
+ <xs:selector xpath='subslots'/>
+ <xs:field xpath='@fake-only-once'/>
+ </xs:unique>
</xs:element>
<xs:element name='upstream' type='upstreamType'>
<xs:unique name='bugsToSingleConstraint'>
@@ -175,25 +179,9 @@
<!-- slots -->
<xs:complexType name='slotsType'>
- <!-- the crazy magic below is to cover any order possible
- in a deterministic way -->
- <xs:choice>
- <xs:sequence>
- <xs:element name='slot' type='slotType'
- minOccurs='1' maxOccurs='unbounded'/>
- <xs:sequence minOccurs='0' maxOccurs='1'>
- <xs:element name='subslots'
type='xs:token'
- minOccurs='1' maxOccurs='1'/>
- <xs:element name='slot' type='slotType'
- minOccurs='0'
maxOccurs='unbounded'/>
- </xs:sequence>
- </xs:sequence>
- <xs:sequence>
- <xs:element name='subslots' type='xs:token'
- minOccurs='1' maxOccurs='1'/>
- <xs:element name='slot' type='slotType'
- minOccurs='0' maxOccurs='unbounded'/>
- </xs:sequence>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='slot' type='slotType'/>
+ <xs:element name='subslots' type='tokenOnceType'/>
</xs:choice>
<xs:attribute name='lang' type='langAttrType' default='en'/>
</xs:complexType>
@@ -532,6 +520,15 @@
</xs:restriction>
</xs:simpleType>
+ <xs:complexType name='tokenOnceType'>
+ <xs:simpleContent>
+ <xs:extension base="xs:token">
+ <xs:attribute name='fake-only-once'
+ fixed='there can be at most one element
of this type'/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
<xs:simpleType name='urlType'>
<xs:restriction base='xs:token'>
<!-- TODO: something better? -->