view toolboxes/xml_toolbox/matlab.xsd @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line source
<!-- Copyright 2002 Geodise Project, University of Southampton -->
<!-- matlab.xsd - Jasmin Wason - 01/11/02 -->
<!-- Schema to validate XML documents generated by the xml_save function -->
<!-- of the XML Toolbox for Matlab written by Marc Molinari. -->
<!-- Modification 14/11/02 Jasmin Wason -->
<!-- Included a definition for the complex element -->
<!-- Modification 27/11/02 Jasmin Wason -->
<!-- Added complex element as a child of struct, sparse and cell -->
<xs:schema targetNamespace="http://www.geodise.org/matlab.xsd" xmlns="http://www.geodise.org/matlab.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<!-- struct element definition -->
	<!-- A struct element contains 0 or more struct, double, char, sparse, cell or complex elements -->
	<!-- These child elements may appear in any order -->
	<!-- A struct element contains a list of attributes as described in the structAttributes attributeGroup -->
	<xs:element name="struct">
		<xs:complexType>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="struct" />
				<xs:element ref="double" />
				<xs:element ref="char" />
				<xs:element ref="sparse" />
				<xs:element ref="cell" />
				<xs:element ref="complex" />
			</xs:choice>
			<xs:attributeGroup ref="structAttributes" />
		</xs:complexType>
	</xs:element>
	<!-- double element definition -->
	<!-- double may contain numerical entities of type integer, double, long etc -->
	<!-- The content is a list of XSD doubles -->
	<!-- and a list of attributes as described in the commonAttributes attributeGroup -->
	<xs:element name="double">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="listOfXsdDoubles">
					<xs:attributeGroup ref="commonAttributes" />
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<!-- char element definition -->
	<!-- char contains alphanumerical entities (characters, strings, etc.) -->
	<!-- The content is an XSD string -->
	<!-- and a list of attributes as described in the commonAttributes attributeGroup -->
	<xs:element name="char">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attributeGroup ref="commonAttributes" />
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	<!-- sparse element  definition -->
	<!-- sparse contains sparse matrices (2 arrays of type double and 1 array of type double or complex) -->
	<!-- ([i], [j], [k]), S(i, j)=k) -->
	<!-- A sparse element is either empty or contains -->
	<!-- a list of 2 double + 1 double or complex element -->
	<!-- and a list of attributes as described in the commonAttributes attributeGroup -->
	<xs:element name="sparse">
		<xs:complexType>
			<xs:sequence minOccurs="0">
				<xs:element ref="double" minOccurs="2" maxOccurs="2" />
				<xs:choice>
					<xs:element ref="double" minOccurs="1" maxOccurs="1" />
					<xs:element ref="complex" minOccurs="1" maxOccurs="1" />
				</xs:choice>
			</xs:sequence>
			<xs:attributeGroup ref="commonAttributes" />
		</xs:complexType>
	</xs:element>
	<!-- cell element definition -->
	<!-- cell contains cell entities -->
	<!-- A cell element contains 0 or more struct, double, char, sparse, cell or complex elements -->
	<!-- These child elements may appear in any order -->
	<!-- A cell element contains a list of attributes as described in the commonAttributes attributeGroup -->
	<xs:element name="cell">
		<xs:complexType>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="struct" />
				<xs:element ref="double" />
				<xs:element ref="char" />
				<xs:element ref="sparse" />
				<xs:element ref="cell" />
				<xs:element ref="complex" />
			</xs:choice>
			<xs:attributeGroup ref="commonAttributes" />
		</xs:complexType>
	</xs:element>
	<!-- complex element  definition -->
	<!-- complex contains complex numbers a+ib with real part a and imaginary part b, which are both represented by entries of type double -->
	<!-- A complex element contains a list of either 2 or 0 double elements -->
	<!-- and a list of attributes as described in the commonAttributes attributeGroup -->
	<xs:element name="complex">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="double" minOccurs="2" maxOccurs="2">
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="nonEmptyListOfXsdDoubles">
								<xs:attributeGroup ref="commonAttributes" />
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attributeGroup ref="commonAttributes" />
		</xs:complexType>
	</xs:element>
	<!-- commonAttributes is a list of attributes that all struct, double, char, sparse and cell elements have -->
	<xs:attributeGroup name="commonAttributes">
		<xs:attribute name="idx" type="xs:integer" use="required" />
		<xs:attribute name="name" type="xs:string" use="optional" />
		<xs:attribute name="size" type="listOfXsdInts" use="optional" default="1 1" />
		<!-- idx indicates what position in the parent array this element belongs. For root element i="0" -->
		<!-- name represents the name of the current element inside a structure -->
		<!-- name only occurs in elements inside a structure, although this schema does not enforce this rule -->
		<!-- size represents the size of the entry. It allows Matlab to form matrices from vectors with reshape() -->
	</xs:attributeGroup>
	<!-- structAttributes is a list of attributes that all struct elements have -->
	<xs:attributeGroup name="structAttributes">
		<xs:attributeGroup ref="commonAttributes" />
		<xs:attribute name="fields" type="listOfXsdStrings" use="optional" />
		<!-- Include all the attributes in commonAttributes -->
		<!-- fields contains the field names of a structure. -->
	</xs:attributeGroup>
	<!-- listOfXsdDoubles is a type describing a list of xs:doubles -->
	<!-- i.e. a double as defined by the XML Schema specification, not matlab.xsd -->
	<xs:simpleType name="listOfXsdDoubles">
		<xs:list itemType="xs:double" />
	</xs:simpleType>
	<!-- nonEmptyListOfXsdDoubles is a type describing a list of xs:doubles -->
	<!-- with length at least 1 -->
	<xs:simpleType name="nonEmptyListOfXsdDoubles">
		<xs:restriction base="listOfXsdDoubles">
			<xs:minLength value="1" />
		</xs:restriction>
	</xs:simpleType>
	<!-- listOfXsdInts is a type describing a list of integers -->
	<xs:simpleType name="listOfXsdInts">
		<xs:list itemType="xs:int" />
	</xs:simpleType>
	<!-- listOfXsdStrings is a type describing a list of strings -->
	<xs:simpleType name="listOfXsdStrings">
		<xs:list itemType="xs:string" />
	</xs:simpleType>
</xs:schema>