view _test/Resources/resources.xsd @ 222:84a6382b49c8

resources schema in progress
author sergey
date Mon, 27 Aug 2012 17:28:32 +0400
parents e997e6fbac0b
children edf011437be8
line wrap: on
line source

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://implab.org/schemas/resources"
	elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://implab.org/schemas/resources">
	<element name="resources">
		<complexType>
			<sequence>
				<element name="root" type="tns:resourceContract" />
				<element name="typeMap" minOccurs="0">
					<complexType>
						<sequence>
							<element name="contract" maxOccurs="unbounded">
								<complexType>
									<complexContent>
										<extension base="tns:resourceContract">
											<sequence></sequence>
											<attribute name="type" type="string" use="required">
											</attribute>
										</extension>
									</complexContent>
								</complexType>
							</element>
						</sequence>
					</complexType>
				</element>
				<element name="locators" minOccurs="0">
					<complexType>
						<sequence>
							<element name="locator" maxOccurs="unbounded">
								<complexType>
									<complexContent>
										<extension base="tns:resourceLocator">
											<attribute name="name" type="string" />
										</extension>
									</complexContent>
								</complexType>
							</element>
						</sequence>
					</complexType>
				</element>
			</sequence>
		</complexType>
		<keyref name="locator-key-ref" refer="tns:locator-key">
			<selector xpath=".//tns:response/tns:locatorRef" />
			<field xpath="@ref" />
		</keyref>
		<key name="locator-key">
			<selector xpath="tns:locators/tns:locator" />
			<field xpath="@name" />
		</key>
	</element>

	<!-- abstract types -->
	<complexType name="abstractBinding" abstract="true" />
	<complexType name="abstractTransformation" abstract="true" />
	<complexType name="abstractResult" abstract="true" />

	<complexType name="resourceContract">
		<sequence>
			<group ref="tns:restOperations"></group>
			<element name="resource" maxOccurs="unbounded" minOccurs="0">
				<complexType>
					<sequence>
						<element name="contract" type="tns:resourceContract" />
					</sequence>
					<attribute name="name" type="string" />
				</complexType>
			</element>
		</sequence>
	</complexType>

	<group name="restOperations">
		<sequence>
			<element name="get" type="tns:operationContract" minOccurs="0" />
			<element name="post" type="tns:operationContract" minOccurs="0" />
			<element name="put" type="tns:operationContract" minOccurs="0" />
			<element name="delete" type="tns:operationContract"
				minOccurs="0" />
		</sequence>
	</group>

	<complexType name="operationContract">
		<sequence>
			<element name="bind" type="tns:methodBinding" />
			<element name="parameters" type="tns:transformation"
				minOccurs="0" />
			<element name="response" type="tns:abstractResult" minOccurs="0" />
		</sequence>
	</complexType>

	<complexType name="methodBinding">
		<sequence>
			<element name="var" type="tns:bindingVariable" minOccurs="0"
				maxOccurs="unbounded" />
		</sequence>
		<attribute name="bind" type="string" use="required" />
	</complexType>

	<complexType name="bindingVariable">
		<complexContent>
			<extension base="tns:methodBinding">
				<attribute name="name" type="string" />
			</extension>
		</complexContent>
	</complexType>


	<complexType name="transformation">
		<attribute name="class" type="string" />
	</complexType>

	<complexType name="resourceLocator">
		<sequence>
			<element name="var" type="tns:bindingVariable" minOccurs="0"
				maxOccurs="unbounded" />
			<element name="template" type="string" />
		</sequence>
	</complexType>

	<simpleType name="redirectCodes">
		<restriction base="string">
			<enumeration value="moved-permanently" />
			<enumeration value="temporary-redirect" />
			<enumeration value="see-other" />
		</restriction>
	</simpleType>

	<complexType name="redirectResponse">
		<complexContent>
			<extension base="tns:abstractResult">
				<choice>
					<element name="locator" type="tns:resourceLocator" />
					<element name="locatorRef">
						<complexType>
							<attribute name="ref" type="string" />
						</complexType>
					</element>
					<element name="status" type="tns:redirectCodes" minOccurs="0" />
				</choice>
			</extension>
		</complexContent>
	</complexType>

</schema>