schema/ssm.xsd
author František Kučera <franta-hg@frantovo.cz>
Wed, 02 Oct 2019 19:10:46 +0200
branchv_0
changeset 42 ef8fd61fd011
parent 25 8da11cce2c98
child 47 7e665331bc32
permissions -rw-r--r--
structured links

<?xml version="1.0" encoding="UTF-8"?>
<!--
	Sane Software Manifesto helper tools
	Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 3.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <https://www.gnu.org/licenses/>.
-->
<xs:schema xmlns="tag:globalcode.info,2019:sane-software/manifesto"
		   targetNamespace="tag:globalcode.info,2019:sane-software/manifesto"
		   xmlns:xs="http://www.w3.org/2001/XMLSchema"
		   elementFormDefault="qualified"
		   attributeFormDefault="unqualified">

	<xs:element name="manifesto" type="Manifesto"/>
	
	<xs:complexType name="Manifesto">
		<xs:sequence>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="id" type="ID"/>
			<xs:element name="preamble" type="xs:string"/>
			<xs:element name="chapter" type="Chapter" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:simpleType name="ID">
		<xs:annotation>
			<xs:documentation>
				UUID, but must start with a letter, to comply with XML ID rules;
				use e.g. uuidgen | grep ^[a-f];
				Never reuse the ID if one chapter/item is removed and another with different meaning is added.
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:ID">
			<xs:pattern value="[a-f][a-f0-9]{7}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>
		</xs:restriction>
	</xs:simpleType>
		
	<xs:complexType name="Chapter">
		<xs:sequence>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="id" type="ID"/>
			<xs:element name="item" type="Item" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="Item">
		<xs:sequence>
			<xs:element name="id" type="ID"/>
			<xs:element name="text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
			<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="link" type="Link" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="item" type="Item" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="Link">
		<xs:sequence>
			<xs:element name="url" type="URL"/>
			<xs:element name="type" type="LinkType"/>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<xs:element name="quotation" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:simpleType name="LinkType" final="restriction" >
		<xs:restriction base="xs:string">
			<xs:enumeration value="related">
				<xs:annotation>
					<xs:documentation>
						generic link
					</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="compatible">
				<xs:annotation>
					<xs:documentation>
						link to a particular compatible rule in another guidelines
					</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="URL">
		<xs:restriction base="xs:string">
			<xs:pattern value="https?://[^ ]+"/>
		</xs:restriction>
	</xs:simpleType>

</xs:schema>