﻿<grammar
	xmlns="http://relaxng.org/ns/structure/1.0"
	datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
	ns="http://www.isocat.org/"
>

	<start>
		<ref name="workspace"/>
	</start>

	<define name="workspace">
		<element name="workspace">
			<attribute name="user">
				<text/>
			</attribute>
			<interleave>
				<optional>
					<element name="private">
						<attribute name="href">
							<data type="anyURI"/>
						</attribute>
						<zeroOrMore>
							<ref name="dcs"/> 
						</zeroOrMore>
						<optional>
							<ref name="dcrb"/>
						</optional>
						<zeroOrMore>
							<ref name="tdg"/> 
						</zeroOrMore>
						<zeroOrMore>
							<ref name="group"/> 
						</zeroOrMore>
						<zeroOrMore>
							<ref name="cr"/> 
						</zeroOrMore>
					</element>
				</optional>
				<optional>
					<element name="shared">
						<attribute name="href">
							<data type="anyURI"/>
						</attribute>
						<zeroOrMore>
							<ref name="dcs"/> 
						</zeroOrMore>
						<optional>
							<ref name="dcrb"/>
						</optional>
						<zeroOrMore>
							<ref name="tdg"/> 
						</zeroOrMore>
						<zeroOrMore>
							<ref name="group"/> 
						</zeroOrMore>
						<zeroOrMore>
							<ref name="cr"/> 
						</zeroOrMore>
					</element>
				</optional>
				<element name="public">
					<optional>
						<element name="views">
							<zeroOrMore>
								<ref name="tdg"/> 
							</zeroOrMore>
						</element>
					</optional>
					<zeroOrMore>
						<ref name="dcs"/> 
					</zeroOrMore>
					<zeroOrMore>
						<ref name="group"/> 
					</zeroOrMore>
				</element>
			</interleave>
		</element>
	</define>
	
	<define name="profile">
		<element name="profile">
			<attribute name="id">
				<text/>
			</attribute>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<zeroOrMore>
				<choice>
					<ref name="profile"/>
					<ref name="dcs"/> 
				</choice>
			</zeroOrMore>
		</element>
	</define>
	
	<define name="dcs">
		<element name="dcs">
			<attribute name="id">
				<text/>
			</attribute>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<zeroOrMore>
				<ref name="dcs"/> 
			</zeroOrMore>
		</element>
	</define>

	<define name="dcrb">
		<element name="dcrb">
			<optional>
				<attribute name="id">
					<text/>
				</attribute>
			</optional>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<zeroOrMore>
				<ref name="cr"/> 
			</zeroOrMore>
		</element>
	</define>

	<define name="tdg">
		<element name="tdg">
			<attribute name="id">
				<text/>
			</attribute>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<zeroOrMore>
				<choice>
					<ref name="profile"/>
					<ref name="dcs"/> 
				</choice>
			</zeroOrMore>
			<zeroOrMore>
				<ref name="cr"/> 
			</zeroOrMore>
		</element>
	</define>

	<define name="group">
		<element name="group">
			<attribute name="id">
				<text/>
			</attribute>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<zeroOrMore>
				<ref name="dcs"/> 
			</zeroOrMore>
		</element>
	</define>
	
	<define name="cr">
		<element name="cr">
			<attribute name="id">
				<text/>
			</attribute>
			<attribute name="name">
				<text/>
			</attribute>
			<attribute name="mode">
				<text/>
			</attribute>
			<attribute name="href">
				<data type="anyURI"/>
			</attribute>
			<attribute name="status">
				<text/>
			</attribute>
			<!--<ref name="dcs"/>--> 
		</element>
	</define>
</grammar>

