<?xml version="1.0" encoding="utf-8"?>
<!-- ===================================================================
XML schema for meta data of the SIARD Format 2.2
Application: Software-Independent Archival of Relational Databases
Platform   : XML 1.0, XML Schema 2001
Description: This XML schema definition defines the structure of the meta data in the SIARD format 2.2.
==============================================================================================
Copyright  : 2007, 2014, 2018, Swiss Federal Archives, Berne, Switzerland, 2021 DILCIS and SFA 
============================================================================================== -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd" targetNamespace="http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.2.1.7" id="metadata">
	<!-- root element of an XML file conforming to this XML schema -->
	<xs:element name="siardArchive">
		<xs:complexType>
			<xs:annotation>
				<xs:documentation>Root element of meta data of the SIARD archive</xs:documentation>
			</xs:annotation>
			<xs:sequence>
				<!-- name of the archived database -->
				<xs:element name="dbname" type="mandatoryString"/>
				<!-- short free form description of the database content -->
				<xs:element name="description" type="xs:string" minOccurs="0"/>
				<!-- name of person responsible for archiving the database -->
				<xs:element name="archiver" type="xs:string" minOccurs="0"/>
				<!-- contact data (telephone number or email address) of archiver -->
				<xs:element name="archiverContact" type="xs:string" minOccurs="0"/>
				<!-- name of data owner (section and institution responsible for data)
             of database when it was archived -->
				<xs:element name="dataOwner" type="mandatoryString"/>
				<!-- time span during which data where entered into the database -->
				<xs:element name="dataOriginTimespan" type="mandatoryString"/>
				<!--  root folder for external files -->
				<xs:element name="lobFolder" type="xs:anyURI" minOccurs="0"/>
				<!-- name and version of program that generated the metadata file -->
				<xs:element name="producerApplication" type="xs:string" minOccurs="0"/>
				<!-- date of creation of archive (automatically generated by SIARD) -->
				<xs:element name="archivalDate" type="xs:date"/>
				<!-- message digest codes over all primary data in folder "content" -->
				<xs:element name="messageDigest" type="messageDigestType" minOccurs="0" maxOccurs="unbounded"/>
				<!-- DNS name of client machine from which connection to the database was established for archiving -->
				<xs:element name="clientMachine" type="xs:string" minOccurs="0"/>
				<!-- name of database product and version from which database originates -->
				<xs:element name="databaseProduct" type="xs:string" minOccurs="0"/>
				<!-- connection string (JDBC URL) used for archiving -->
				<xs:element name="connection" type="xs:string" minOccurs="0"/>
				<!-- database user used for archiving -->
				<xs:element name="databaseUser" type="xs:string" minOccurs="0"/>
				<!--  list of schemas in database  -->
				<xs:element name="schemas" type="schemasType"/>
				<!-- list of users in the archived database -->
				<xs:element name="users" type="usersType"/>
				<!-- list of roles in the archived database -->
				<xs:element name="roles" type="rolesType" minOccurs="0"/>
				<!-- list of privileges in the archived database -->
				<xs:element name="privileges" type="privilegesType" minOccurs="0"/>
			</xs:sequence>
			<xs:attribute name="version" type="versionType" use="required"/>
			<!-- constraint: version number with release -->
		</xs:complexType>
	</xs:element>
	<!-- complex type schemas -->
	<xs:complexType name="schemasType">
		<xs:annotation>
			<xs:documentation>List of schemas</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="schema" type="schemaType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type schema -->
	<xs:complexType name="schemaType">
		<xs:annotation>
			<xs:documentation>Schema element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the schema -->
			<xs:element name="name" type="xs:string"/>
			<!-- archive name of the schema folder -->
			<xs:element name="folder" type="fsName"/>
			<!-- description of the schema's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<!--  list of advanced and structured types in the schema -->
			<xs:element name="types" type="typesType" minOccurs="0"/>
			<!-- list of tables in the schema -->
			<xs:element name="tables" type="tablesType" minOccurs="0"/>
			<!-- list of views in the schema -->
			<xs:element name="views" type="viewsType" minOccurs="0"/>
			<!-- list of routines in the schema -->
			<xs:element name="routines" type="routinesType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type types -->
	<xs:complexType name="typesType">
		<xs:annotation>
			<xs:documentation>List of advanced or structured data types types</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="type" type="typeType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type type -->
	<xs:complexType name="typeType">
		<xs:annotation>
			<xs:documentation>Advanced or structured data tape type</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!--  name of data type  -->
			<xs:element name="name" type="xs:string"/>
			<!--  category of data type -->
			<xs:element name="category" type="categoryType"/>
			<!--  schema of supertype -->
			<xs:element name="underSchema" type="xs:string" minOccurs="0"/>
			<!--  name of supertype -->
			<xs:element name="underType" type="xs:string" minOccurs="0"/>
			<!-- instantiability if data type (never true for DISTINCT) -->
			<xs:element name="instantiable" type="xs:boolean"/>
			<!-- finality (always true for DISTINCT, never true for structured UDTs) -->
			<xs:element name="final" type="xs:boolean"/>
			<!--  predefined base SQL:2008 type of (DISTINCT) type -->
			<xs:element name="base" type="predefinedTypeType" minOccurs="0"/>
			<!--  alternatively list of attributes (UDT) -->
			<xs:element name="attributes" type="attributesType" minOccurs="0"/>
			<!-- description of the parameter's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type attributes -->
	<xs:complexType name="attributesType">
		<xs:annotation>
			<xs:documentation>List of attributes of a type</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="attribute" type="attributeType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type attribute -->
	<xs:complexType name="attributeType">
		<xs:annotation>
			<xs:documentation>Attribute of a type</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the attribute -->
			<xs:element name="name" type="xs:string"/>
			<xs:choice>
				<!-- either predefined or structured -->
				<xs:sequence>
					<!-- SQL:2008 data type of the column -->
					<xs:element name="type" type="predefinedTypeType"/>
				</xs:sequence>
				<xs:sequence>
					<!-- SQL:2008 schema of advanced or structured data type of the attribute -->
					<xs:element name="typeSchema" type="xs:string" minOccurs="0"/>
					<!-- SQL:2008 name of advanced or structured data type of the attribute -->
					<xs:element name="typeName" type="xs:string"/>
				</xs:sequence>
			</xs:choice>
			<!-- original data type of the column -->
			<xs:element name="typeOriginal" type="xs:string" minOccurs="0"/>
			<!-- nullability (default: true) -->
			<xs:element name="nullable" type="xs:boolean" minOccurs="0"/>
			<!-- default value -->
			<xs:element name="defaultValue" type="xs:string" minOccurs="0"/>
			<!--  SQL_1999 cardinality for ARRAY type -->
			<xs:element name="cardinality" type="xs:integer" minOccurs="0"/>
			<!-- description of the attributes's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type tables -->
	<xs:complexType name="tablesType">
		<xs:annotation>
			<xs:documentation>List of tables</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="table" type="tableType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type table -->
	<xs:complexType name="tableType">
		<xs:annotation>
			<xs:documentation>Table element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the table -->
			<xs:element name="name" type="xs:string"/>
			<!-- archive name of the table folder -->
			<xs:element name="folder" type="fsName"/>
			<!-- description of the table's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<!-- list of columns of the table -->
			<xs:element name="columns" type="columnsType"/>
			<!--  primary key -->
			<xs:element name="primaryKey" type="uniqueKeyType" minOccurs="0"/>
			<!--  foreign keys  -->
			<xs:element name="foreignKeys" type="foreignKeysType" minOccurs="0"/>
			<!--  candidate keys (unique constraints)  -->
			<xs:element name="candidateKeys" type="candidateKeysType" minOccurs="0"/>
			<!-- list of (check) constraints -->
			<xs:element name="checkConstraints" type="checkConstraintsType" minOccurs="0"/>
			<!--  list of triggers  -->
			<xs:element name="triggers" type="triggersType" minOccurs="0"/>
			<!--  number of rows in the table -->
			<xs:element name="rows" type="xs:integer"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type views -->
	<xs:complexType name="viewsType">
		<xs:annotation>
			<xs:documentation>List of views</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="view" type="viewType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type view -->
	<xs:complexType name="viewType">
		<xs:annotation>
			<xs:documentation>View element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the view -->
			<xs:element name="name" type="xs:string"/>
			<!-- SQL query string defining the view -->
			<xs:element name="query" type="xs:string" minOccurs="0"/>
			<!-- original query string defining the view -->
			<xs:element name="queryOriginal" type="xs:string" minOccurs="0"/>
			<!-- description of the view's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<!-- list of columns of the view -->
			<xs:element name="columns" type="columnsType"/>
			<!--  number of rows in the view - added in 2014! -->
			<xs:element name="rows" type="xs:integer" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type columns -->
	<xs:complexType name="columnsType">
		<xs:annotation>
			<xs:documentation>List of columns</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="column" type="columnType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type column -->
	<xs:complexType name="columnType">
		<xs:annotation>
			<xs:documentation>Column element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the column -->
			<xs:element name="name" type="xs:string"/>
			<!--  folder for LOBs relative to lobFolder of nearest containing 
            element for internally or externally stored LOBs -->
			<xs:element name="lobFolder" type="xs:anyURI" minOccurs="0"/>
			<xs:choice>
				<!-- either predefined or structured -->
				<xs:sequence>
					<!-- SQL:2008 predefined data type of the column -->
					<xs:element name="type" type="predefinedTypeType"/>
					<!--  mimeType makes sense only for LOBs and is only informatory -->
					<xs:element name="mimeType" type="xs:string" minOccurs="0"/>
				</xs:sequence>
				<xs:sequence>
					<!-- SQL:2008 schema of UDT name of the column -->
					<xs:element name="typeSchema" type="xs:string" minOccurs="0"/>
					<!-- SQL:2008 name of UDT of the column -->
					<xs:element name="typeName" type="xs:string"/>
				</xs:sequence>
			</xs:choice>
			<!-- original data type of the column -->
			<xs:element name="typeOriginal" type="xs:string" minOccurs="0"/>
			<!-- SQL:2008 attribute list of the column -->
			<xs:element name="fields" type="fieldsType" minOccurs="0"/>
			<!-- nullability (default: true) -->
			<xs:element name="nullable" type="xs:boolean" minOccurs="0"/>
			<!-- default value -->
			<xs:element name="defaultValue" type="xs:string" minOccurs="0"/>
			<!--  SQL_1999 cardinality for ARRAY type -->
			<xs:element name="cardinality" type="xs:integer" minOccurs="0"/>
			<!-- unique, references, check column constraints 
           are stored as table constraints -->
			<!-- description of the column's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type fields -->
	<xs:complexType name="fieldsType">
		<xs:annotation>
			<xs:documentation>List of fields of a column or field</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="field" type="fieldType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type for type of a column or a field -->
	<xs:complexType name="fieldType">
		<xs:annotation>
			<xs:documentation>Field element describing the type of a field</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- attribute name or array element position (1-based) -->
			<xs:element name="name" type="xs:string"/>
			<!--  folder for LOBs relative to lobFolder of nearest containing 
            element for internally or externally stored LOBs -->
			<xs:element name="lobFolder" type="xs:anyURI" minOccurs="0"/>
			<!-- SQL:2008 sub field list of the field -->
			<xs:element name="fields" type="fieldsType" minOccurs="0"/>
			<!--  mimeType makes sense only for LOBs and is only informatory-->
			<xs:element name="mimeType" type="xs:string" minOccurs="0"/>
			<!-- description of the field's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type foreignKeys -->
	<xs:complexType name="foreignKeysType">
		<xs:annotation>
			<xs:documentation>List of foreign key constraints</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="foreignKey" type="foreignKeyType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type foreignKey -->
	<xs:complexType name="foreignKeyType">
		<xs:annotation>
			<xs:documentation>foreignKey element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the foreign key -->
			<xs:element name="name" type="xs:string"/>
			<!--  referenced schema -->
			<xs:element name="referencedSchema" type="xs:string"/>
			<!-- referenced table -->
			<xs:element name="referencedTable" type="xs:string"/>
			<!--  references -->
			<xs:element name="reference" type="referenceType" maxOccurs="unbounded"/>
			<!-- match type (FULL, PARTIAL, SIMPLE) -->
			<xs:element name="matchType" type="matchTypeType" minOccurs="0"/>
			<!-- ON DELETE action e.g. ON DELETE CASCADE -->
			<xs:element name="deleteAction" type="referentialActionType" minOccurs="0"/>
			<!-- ON UPDATE action e.g. ON UPDATE SET DEFAULT -->
			<xs:element name="updateAction" type="referentialActionType" minOccurs="0"/>
			<!-- description of the foreign key's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type reference -->
	<xs:complexType name="referenceType">
		<xs:annotation>
			<xs:documentation>reference element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- referencing column -->
			<xs:element name="column" type="xs:string"/>
			<!-- referenced column (table.column) -->
			<xs:element name="referenced" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type candidateKeys -->
	<xs:complexType name="candidateKeysType">
		<xs:annotation>
			<xs:documentation>List of candidate key (unique) constraints</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="candidateKey" type="uniqueKeyType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type uniqueKey -->
	<xs:complexType name="uniqueKeyType">
		<xs:annotation>
			<xs:documentation>unique (primary or candidate) key element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the unique key -->
			<xs:element name="name" type="xs:string"/>
			<!-- description of the unique key's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<!-- columns belonging to the unique key -->
			<xs:element name="column" type="xs:string" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type check constraints -->
	<xs:complexType name="checkConstraintsType">
		<xs:annotation>
			<xs:documentation>List of check constraints</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="checkConstraint" type="checkConstraintType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type check constraint -->
	<xs:complexType name="checkConstraintType">
		<xs:annotation>
			<xs:documentation>Check constraint element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the constraint -->
			<xs:element name="name" type="xs:string"/>
			<!-- check condition -->
			<xs:element name="condition" type="xs:string"/>
			<!-- description of the constraint's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type triggers -->
	<xs:complexType name="triggersType">
		<xs:annotation>
			<xs:documentation>List of triggers</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="trigger" type="triggerType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type trigger -->
	<xs:complexType name="triggerType">
		<xs:annotation>
			<xs:documentation>Trigger element in siardArchive</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- database name of the trigger -->
			<xs:element name="name" type="xs:string"/>
			<!--  action time BEFORE, AFTER or INSTEAD OF -->
			<xs:element name="actionTime" type="actionTimeType"/>
			<!--  trigger event INSERT, DELETE, UPDATE [OF <trigger column list>] -->
			<xs:element name="triggerEvent" type="xs:string"/>
			<!--  alias list <old or new values alias> -->
			<xs:element name="aliasList" type="xs:string" minOccurs="0"/>
			<!--  triggered action -->
			<xs:element name="triggeredAction" type="xs:string"/>
			<!-- description of the trigger's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type routines -->
	<xs:complexType name="routinesType">
		<xs:annotation>
			<xs:documentation>List of routines</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="routine" type="routineType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type routine -->
	<xs:complexType name="routineType">
		<xs:annotation>
			<xs:documentation>Routine</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!--  specific (unique) name of routine in schema -->
			<xs:element name="specificName" type="xs:string"/>
			<!-- database (possible overloaded) name of routine in schema -->
			<xs:element name="name" type="xs:string"/>
			<!-- description of the routines's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
			<!-- original source code (VBA, PL/SQL, ...) defining the routine -->
			<xs:element name="source" type="xs:string" minOccurs="0"/>
			<!--  SQL:2008 body of routine  -->
			<xs:element name="body" type="xs:string" minOccurs="0"/>
			<!--  routine characteristic -->
			<xs:element name="characteristic" type="xs:string" minOccurs="0"/>
			<!--  SQL:2008 data type of the return value (for functions) -->
			<xs:element name="returnType" type="xs:string" minOccurs="0"/>
			<!--  list of parameters -->
			<xs:element name="parameters" type="parametersType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type parameters -->
	<xs:complexType name="parametersType">
		<xs:annotation>
			<xs:documentation>List of parameters of a routine</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="parameter" type="parameterType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type parameter -->
	<xs:complexType name="parameterType">
		<xs:annotation>
			<xs:documentation>Parameter of a routine</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!--  name of parameter  -->
			<xs:element name="name" type="xs:string"/>
			<!--  mode of parameter (IN, OUT, INOUT) -->
			<xs:element name="mode" type="xs:string"/>
			<xs:choice>
				<!-- either predefined or structured -->
				<xs:sequence>
					<!-- SQL:2008 data type of the column -->
					<xs:element name="type" type="predefinedTypeType"/>
				</xs:sequence>
				<xs:sequence>
					<!-- SQL:2008 schema of UDT name of the column -->
					<xs:element name="typeSchema" type="xs:string" minOccurs="0"/>
					<!-- SQL:2008 name of UDT of the column -->
					<xs:element name="typeName" type="xs:string"/>
				</xs:sequence>
			</xs:choice>
			<!-- original data type of the column -->
			<xs:element name="typeOriginal" type="xs:string" minOccurs="0"/>
			<!--  SQL_1999 cardinality for ARRAY type -->
			<xs:element name="cardinality" type="xs:integer" minOccurs="0"/>
			<!-- description of the parameter's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type users -->
	<xs:complexType name="usersType">
		<xs:annotation>
			<xs:documentation>List of users</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="user" type="userType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type user -->
	<xs:complexType name="userType">
		<xs:annotation>
			<xs:documentation>User</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- user name -->
			<xs:element name="name" type="xs:string"/>
			<!-- description of the user's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type roles -->
	<xs:complexType name="rolesType">
		<xs:annotation>
			<xs:documentation>List of roles</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="role" type="roleType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type role -->
	<xs:complexType name="roleType">
		<xs:annotation>
			<xs:documentation>Role</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- role name -->
			<xs:element name="name" type="xs:string"/>
			<!-- role ADMIN (user or role) -->
			<xs:element name="admin" type="xs:string"/>
			<!-- description of the role's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type privileges -->
	<xs:complexType name="privilegesType">
		<xs:annotation>
			<xs:documentation>List of grants</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="privilege" type="privilegeType" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- complex type privilege -->
	<xs:complexType name="privilegeType">
		<xs:annotation>
			<xs:documentation>Grant (incl. grant of role)</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<!-- privilege type (incl. ROLE privilege or "ALL PRIVILEGES" -->
			<xs:element name="type" type="xs:string"/>
			<!-- privilege object (may be omitted for ROLE privilege) -->
			<xs:element name="object" type="xs:string" minOccurs="0"/>
			<!-- GRANTED BY -->
			<xs:element name="grantor" type="xs:string"/>
			<!-- user list of users or roles or single value "PUBLIC" -->
			<xs:element name="grantee" type="xs:string"/>
			<!-- optional option "GRANT" or "ADMIN" -->
			<xs:element name="option" type="privOptionType" minOccurs="0"/>
			<!-- description of the grant's meaning and content -->
			<xs:element name="description" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!--  complex type for messageDigest with separate algorithm field -->
	<xs:complexType name="messageDigestType">
		<xs:annotation>
			<xs:documentation>Message digests with algorithm ("MD5", "SHA-1" or "SHA-256") and hexadecimal or - for the SHA variants - Base64 code.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="digestType" type="digestTypeType"/>
			<xs:element name="digest" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<!-- simple type fpr predefined SQL:2008 types -->
	<xs:simpleType name="predefinedTypeType">
		<xs:annotation>
			<xs:documentation>predefinedTypeType is constrained to valid SQL:2008 data type values</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="INTEGER|INT|SMALLINT|BIGINT"/>
			<xs:pattern value="(NUMERIC|DECIMAL|DEC)(\s*\(\s*[1-9]\d*\s*(,\s*\d+\s*)?\))?"/>
			<xs:pattern value="REAL|DOUBLE PRECISION"/>
			<xs:pattern value="FLOAT(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(CHARACTER|CHAR)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(CHARACTER\s+VARYING|CHAR\s+VARYING|VARCHAR)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(CHARACTER\s+LARGE\s+OBJECT|CLOB)(\s*\(\s*[1-9]\d*(\s*(K|M|G))?\s*\))?"/>
			<xs:pattern value="(NATIONAL\s+CHARACTER|NATIONAL\s+CHAR|NCHAR)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(NATIONAL\s+CHARACTER\s+VARYING|NATIONAL\s+CHAR\s+VARYING|NCHAR VARYING)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(NATIONAL\s+CHARACTER\s+LARGE\s+OBJECT|NCHAR\s+LARGE\s+OBJECT|NCLOB)(\s*\(\s*[1-9]\d*(\s*(K|M|G))?\s*\))?"/>
			<xs:pattern value="XML"/>
			<xs:pattern value="BINARY(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(BINARY\s+VARYING|VARBINARY)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(BINARY\s+LARGE\s+OBJECT|BLOB)(\s*\(\s*[1-9]\d*(\s*(K|M|G))?\s*\))?"/>
			<xs:pattern value="DATE"/>
			<xs:pattern value="(TIME|TIME\s+WITH\s+TIME\s+ZONE)(\s*\(\s*[1-9]\d*\s*\))?"/>
			<xs:pattern value="(TIMESTAMP|TIMESTAMP\s+WITH\s+TIME\s+ZONE)(\s*\(\s*(0|([1-9]\d*))\s*\))?"/>
			<xs:pattern value="INTERVAL\s+(((YEAR|MONTH|DAY|HOUR|MINUTE)(\s*\(\s*[1-9]\d*\s*\))?(\s+TO\s+(MONTH|DAY|HOUR|MINUTE|SECOND)(\s*\(\s*[1-9]\d*\s*\))?)?)|(SECOND(\s*\(\s*[1-9]\d*\s*(,\s*\d+\s*)?\))?))"/>
			<xs:pattern value="BOOLEAN"/>
			<xs:pattern value="DATALINK"/>
			<!-- exact numerics (BIGINT from SQL:2008) -->
			<!-- approximate numerics -->
			<!-- character strings -->
			<!-- BINARY strings from SQL:2008 -->
			<!-- datetimes -->
			<!-- BOOLEAN -->
			<!-- DATALINK - from SQL:2008, part 9, SQL/MED -->
		</xs:restriction>
	</xs:simpleType>
	<!--  type for message digest type -->
	<xs:simpleType name="digestTypeType">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="collapse"/>
			<xs:enumeration value="MD5"/>
			<xs:enumeration value="SHA-1"/>
			<xs:enumeration value="SHA-256"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for version number -->
	<xs:simpleType name="versionType">
		<xs:annotation>
			<xs:documentation>versionType is constrained to "2.2" for conformity with this XML schema</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="collapse"/>
			<xs:enumeration value="2.2"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for privilege option -->
	<xs:simpleType name="privOptionType">
		<xs:annotation>
			<xs:documentation>privOptionType must be "ADMIN" or "GRANT"</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="collapse"/>
			<xs:enumeration value="ADMIN"/>
			<xs:enumeration value="GRANT"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for mandatory string 
       which must contain at least 1 character -->
	<xs:simpleType name="mandatoryString">
		<xs:annotation>
			<xs:documentation>mandatoryString must contain at least 1 character</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:minLength value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type of a filesystem (file or folder) name -->
	<xs:simpleType name="fsName">
		<xs:annotation>
			<xs:documentation>fsNames may only consist of ASCII characters and digits and must start with a non-digit</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
			<xs:pattern value="([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]).*"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for action time of a trigger -->
	<xs:simpleType name="actionTimeType">
		<xs:annotation>
			<xs:documentation>actionTime is BEFORE or AFTER</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="BEFORE"/>
			<xs:enumeration value="INSTEAD OF"/>
			<xs:enumeration value="AFTER"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for match type of a foreign key -->
	<xs:simpleType name="matchTypeType">
		<xs:annotation>
			<xs:documentation>matchType is FULL, PARTIAL or SIMPLE</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="FULL"/>
			<xs:enumeration value="PARTIAL"/>
			<xs:enumeration value="SIMPLE"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for referential action of a foreign key -->
	<xs:simpleType name="referentialActionType">
		<xs:annotation>
			<xs:documentation>referential action is CASCADE, SET NULL, SET DEFAULT, RESTRICT, or NO ACTION</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="CASCADE"/>
			<xs:enumeration value="SET NULL"/>
			<xs:enumeration value="SET DEFAULT"/>
			<xs:enumeration value="RESTRICT"/>
			<xs:enumeration value="NO ACTION"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- simple type for the category of a column or a parameter -->
	<xs:simpleType name="categoryType">
		<xs:annotation>
			<xs:documentation>category of advanced or structured data types is "distinct" or "udt" for conformity with this XML schema</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="collapse"/>
			<xs:enumeration value="distinct"/>
			<xs:enumeration value="udt"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- complex type for the character large object - to be used in table[n].xsd - T_6.2-1 -->
	<xs:complexType name="clobType">
		<xs:annotation>
			<xs:documentation source="T_6.2-1" xml:lang="en">a character large object can either be stored inline or as a file internally or externally. 
			The length is in characters, not in bytes.</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="file" type="xs:anyURI"/>
				<xs:attribute name="length" type="xs:integer"/>
				<xs:attribute name="digestType" type="digestTypeType"/>
				<xs:attribute name="digest" type="xs:string"/>
				<xs:attribute name="dlurlpathonly" type="xs:anyURI"  /> 			<!-- applies only to external LOBs -->
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<!-- complex type for the binary large object - to be used in table[n].xsd -->
	<xs:complexType name="blobType">
		<xs:annotation>
			<xs:documentation source="T_6.2-1" xml:lang="en">a binary large object can either be stored inline or as a file internally or externally. 
			The length is in bytes.</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:hexBinary">
				<xs:attribute name="file" type="xs:anyURI"/>
				<xs:attribute name="length" type="xs:integer"/>
				<xs:attribute name="digestType" type="digestTypeType"/>
				<xs:attribute name="digest" type="xs:string"/>
				<xs:attribute name="dlurlpathonly" type="xs:anyURI"/> 			<!-- applies only to external LOBs -->
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema>
