Skip to content

Commit

Permalink
schema/ListedLicense: Do not allow <alt> or <optional> inside <alt>
Browse files Browse the repository at this point in the history
By differentiating between formattedAltText..., which may contain
<alt> and <optional>, and formattedFixedText..., which may not.  The
optionalType is using formattedAltTextGroup, because nesting variable
content inside an optional element can be useful [1,2].  The <alt>
element, on the other hand, specifies all the variable options in its
match attribute, so there's no need for nesting variable elements
inside the alt body.

Also require fixed text for <notes>, since those aren't templates.
And drop the unused notesType, since they're vanilla formatted text.

We almost certainly want to drop titleText and copyrightText fro the
formatted*TextGroup choices, but I'm leaving that for [3].

[1]: spdx#393
[2]: spdx#462
[3]: spdx#452
  • Loading branch information
wking committed Nov 6, 2017
1 parent 4aac6f8 commit 1825366
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions schema/ListedLicense.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<complexType name="ExceptionType" mixed="true">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="string" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="bullet" type="string"/>
<element name="list" type="tns:listType"/>
<element name="p" type="tns:formattedTextType"/>
<element name="p" type="tns:formattedAltTextType"/>
<element name="optional" type="tns:optionalType"/>
<element name="alt" type="tns:altType"/>
<element name="br" type="tns:emptyType"/>
Expand All @@ -38,13 +38,13 @@
<complexType name="LicenseType" mixed="true">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="string" minOccurs="0" maxOccurs="1"/>
<element name="standardLicenseHeader" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="standardLicenseHeader" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="bullet" type="string"/>
<element name="list" type="tns:listType"/>
<element name="p" type="tns:formattedTextType"/>
<element name="p" type="tns:formattedAltTextType"/>
<element name="optional" type="tns:optionalType"/>
<element name="alt" type="tns:altType"/>
<element name="br" type="tns:emptyType"/>
Expand All @@ -57,47 +57,52 @@
<attribute name="listVersionAdded" type="string"/>
<attribute name="deprecatedVersion" type="string"/>
</complexType>
<complexType name="notesType" mixed="true">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="p" type="tns:formattedTextType"/>
<element name="br" type="tns:emptyType"/>
<element name="bullet" type="string"/>
<element name="list" type="tns:listType"/>
</choice>
</complexType>
<complexType name="crossRefsType">
<sequence>
<element name="crossRef" type="string" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="altType" mixed="true">
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
<group ref="tns:formattedFixedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
<attribute name="name" type="string"/>
<attribute name="match" type="string"/>
</complexType>
<complexType name="optionalType" mixed="true">
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
<group ref="tns:formattedAltTextGroup" minOccurs="0" maxOccurs="unbounded"/>
</complexType>
<complexType name="listType">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="item" type="tns:formattedTextType"/>
<element name="item" type="tns:formattedAltTextType"/>
<element name="list" type="tns:listType"/>
</choice>
</complexType>
<complexType name="emptyType"/>
<complexType name="formattedTextType" mixed="true">
<group ref="tns:formattedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
<complexType name="formattedFixedTextType" mixed="true">
<group ref="tns:formattedFixedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
</complexType>
<complexType name="formattedAltTextType" mixed="true">
<group ref="tns:formattedAltTextGroup" minOccurs="0" maxOccurs="unbounded"/>
</complexType>
<group name="formattedTextGroup">
<group name="formattedFixedTextGroup">
<choice>
<element name="p" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="unbounded"/>
<element name="bullet" type="string" minOccurs="0" maxOccurs="unbounded"/>
<element name="list" type="tns:listType" minOccurs="0" maxOccurs="unbounded"/>
<element name="br" type="tns:emptyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="titleText" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
</choice>
</group>
<group name="formattedAltTextGroup">
<choice>
<element name="p" type="tns:formattedTextType" minOccurs="0" maxOccurs="unbounded"/>
<element name="p" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="unbounded"/>
<element name="bullet" type="string" minOccurs="0" maxOccurs="unbounded"/>
<element name="list" type="tns:listType" minOccurs="0" maxOccurs="unbounded"/>
<element name="optional" type="tns:optionalType" minOccurs="0" maxOccurs="unbounded"/>
<element name="alt" type="tns:altType" minOccurs="0" maxOccurs="unbounded"/>
<element name="br" type="tns:emptyType" minOccurs="0" maxOccurs="unbounded"/>
<element name="titleText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
</choice>
</group>
</schema>

0 comments on commit 1825366

Please sign in to comment.