<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.nexml.org/1.0"
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	xmlns="http://www.nexml.org/1.0"
	xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sawsdl="http://www.w3.org/ns/sawsdl">
	
	<xs:annotation>
		<xs:documentation>
			This module defines annotations that can be attached to
			(almost) any nexml element. The markup for these annotations
			is like that of xml-plists, such as are used by iTunes
			libraries and other Mac OS X configuration files. However,
			this module extends on that by defining more simple types
			that can be used as values of the key/value pairs that
			comprise the annotation. In particular, the additional types
			are lists of atomic simple types, so that a value can be a
			list of integers, for example.
		</xs:documentation>
	</xs:annotation>

	<xs:import namespace="http://www.w3.org/XML/1998/namespace"
		schemaLocation="../external/xml.xsd" />
	<xs:import namespace="http://www.w3.org/1999/xlink"
		schemaLocation="../external/xlink.xsd" />
	<xs:import namespace="http://www.w3.org/ns/sawsdl" 
		schemaLocation="../external/sawsdl.xsd"/>

	<!-- the following types define attachments for objects -->

	<!-- first define complex dict values -->
	<xs:simpleType name="IntegerVector">
		<xs:list itemType="xs:integer" />
	</xs:simpleType>
	<xs:simpleType name="FloatVector">
		<xs:list itemType="xs:float" />
	</xs:simpleType>
	<xs:simpleType name="StringVector">
		<xs:list itemType="xs:string" />
	</xs:simpleType>
	<xs:simpleType name="BooleanVector">
		<xs:list itemType="xs:boolean" />
	</xs:simpleType>
	<xs:simpleType name="DateVector">
		<xs:list itemType="xs:dateTime" />
	</xs:simpleType>
	<xs:simpleType name="UrlVector">
		<xs:list itemType="xs:anyURI" />
	</xs:simpleType>
	<xs:simpleType name="IDVector">
		<xs:list itemType="xs:NCName" />
	</xs:simpleType>
	<xs:simpleType name="Base64Vector">
		<xs:list itemType="xs:base64Binary" />
	</xs:simpleType>

	<!-- now the complex structures -->

	<xs:complexType name="Base" abstract="true">
		<xs:annotation>
			<xs:documentation>
				The base type for all complexType definitions in the
				nexml schema. This type allows a number of special
				attributes:
				<ul>
					<li>xml:lang - for languages codes</li>
					<li>
						xml:base - see
						<a href="http://www.w3.org/TR/xmlbase/">
							http://www.w3.org/TR/xmlbase/
						</a>
					</li>
					<li>
						xml:id - see
						<a href="http://www.w3.org/TR/xml-id/">
							http://www.w3.org/TR/xml-id/
						</a>
					</li>
					<li>xml:space - for whitespace handling</li>
					<li>xlink:href - for links</li>
					<li>class - for class membership</li>
				</ul>
				Also see http://www.w3.org/2001/xml.xsd for more
				information on the xml and xlink attributes.
			</xs:documentation>
		</xs:annotation>
		<xs:sequence />
		<xs:attributeGroup ref="xml:specialAttrs" />
		<xs:attribute ref="xlink:href" use="optional" />
		<xs:attribute name="class" type="IDVector" use="optional" />
	</xs:complexType>

	<!-- dict data structure -->
	<xs:complexType name="Dict">
		<xs:annotation>
			<xs:documentation>
				A dictionary; a sequence of key/value pairs, where the
				value elements are of some type.
			</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="Base">
				<xs:sequence minOccurs="1" maxOccurs="unbounded">
					<xs:element name="key" minOccurs="1" maxOccurs="1"
						type="xs:string" />
					<xs:choice minOccurs="1" maxOccurs="1">
						<xs:element name="base64"
							type="xs:base64Binary" />
						<xs:element name="base64vector"
							type="Base64Vector" />
						<xs:element name="date" type="xs:dateTime" />
						<xs:element name="datevector" type="DateVector" />
						<xs:element name="boolean" type="xs:boolean" />
						<xs:element name="booleanvector"
							type="BooleanVector" />
						<xs:element name="float" type="xs:float" />
						<xs:element name="floatvector"
							type="FloatVector" />
						<xs:element name="id" type="xs:ID" />
						<xs:element name="idvector" type="IDVector" />
						<xs:element name="integer" type="xs:integer" />
						<xs:element name="integervector"
							type="IntegerVector" />
						<xs:element name="string" type="xs:string" />
						<xs:element name="stringvector"
							type="StringVector" />
						<xs:element name="url" type="xs:anyURI" />
						<xs:element name="urlvector" type="UrlVector" />
						<xs:element name="dict" type="Dict" />
						<xs:element name="dictvector" type="DictVector" />
						<xs:element name="any" type="xs:anyType"
							form="unqualified" />
					</xs:choice>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

	<!-- array data structure -->
	<xs:complexType name="DictVector">
		<xs:annotation>
			<xs:documentation>
				A vector of dictionaries.
			</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="Base">
				<xs:sequence minOccurs="1" maxOccurs="unbounded">
					<xs:element name="dict" type="Dict" />
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

</xs:schema>