diff _test/Resources/resources.xsd @ 221:e997e6fbac0b

sync: working on resources schema
author sergey
date Fri, 24 Aug 2012 16:24:14 +0400
parents 5c82c15b25b1
children 84a6382b49c8
line wrap: on
line diff
--- a/_test/Resources/resources.xsd	Thu Aug 23 17:44:31 2012 +0400
+++ b/_test/Resources/resources.xsd	Fri Aug 24 16:24:14 2012 +0400
@@ -1,98 +1,138 @@
 <?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:restResource"></element>
-    			<element name="typeMap" minOccurs="0">
-    				<complexType>
-    					<sequence>
-    						<element name="item" maxOccurs="unbounded">
-    							<complexType>
-    								<complexContent>
-    									<extension
-    										base="tns:restResource">
-    										<sequence></sequence>
-    										<attribute
-    											name="type" type="string">
-    										</attribute>
-    									</extension>
-    								</complexContent>
-    							</complexType></element>
-    					</sequence>
-    				</complexType>
-    			</element>
-    		</sequence>
-    	</complexType>
-    </element>
-    
-    <!-- abstract types  -->
-    <complexType name="abstractBinding" abstract="true"/>
-    <complexType name="abstractTransformation" abstract="true" />
-    <complexType name="abstractResult" abstract="true" />
-    
-    <complexType name="restResource">
-        <sequence>
-    		<element name="get" type="tns:restOperation" minOccurs="0"/>
-    		<element name="post" type="tns:restOperation" minOccurs="0"/>
-    		<element name="put" type="tns:restOperation" minOccurs="0"/>
-    		<element name="delete" type="tns:restOperation" minOccurs="0"/>
-    		<element name="resource" type="string" maxOccurs="unbounded" minOccurs="0"/>
-    	</sequence>
-    </complexType>
-    
-    <complexType name="restOperation">
-    	<sequence>
-    		<element name="bind" type="tns:methodBinding"/>
-    		<element name="parameters" type="tns:transformation" minOccurs="0"/>
-    		<element name="result" type="tns:abstractResult" minOccurs="0"/>
-    	</sequence>
-    </complexType>
-    
-    <complexType name="methodBinding" >
-        <sequence>
-            <element name="var" type="tns:bindingVariable" minOccurs="0" maxOccurs="unbounded"/>
-        </sequence>
-        <attribute name="text" 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="redirectResult">
-        <complexContent>
-            <extension base="tns:abstractResult">
-                <sequence>
-                    <element name="locator" type="tns:resourceLocator" />
-                    <element name="status" type="tns:redirectCodes" minOccurs="0"/>
-                </sequence>
-            </extension>
-        </complexContent>
-    </complexType>
+<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:restResource" />
+				<element name="typeMap" minOccurs="0">
+					<complexType>
+						<sequence>
+							<element name="item" maxOccurs="unbounded">
+								<complexType>
+									<complexContent>
+										<extension base="tns:restResource">
+											<sequence></sequence>
+											<attribute name="type" type="string">
+											</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" />
+										</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="restResource">
+		<sequence>
+			<element name="get" type="tns:restOperation" minOccurs="0" />
+			<element name="post" type="tns:restOperation" minOccurs="0" />
+			<element name="put" type="tns:restOperation" minOccurs="0" />
+			<element name="delete" type="tns:restOperation" minOccurs="0" />
+			<element name="resource" maxOccurs="unbounded"
+				minOccurs="0" >
+				<complexType>
+				    <complexContent>
+				        <extension base="tns:restResource">
+				        </extension>
+				    </complexContent>
+				</complexType>
+				</element>
+		</sequence>
+	</complexType>
+
+	<complexType name="restOperation">
+		<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="text" 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="redirectResult">
+		<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>
\ No newline at end of file