<?xml version="1.0" encoding="UTF-8"?>
<!--
	Changes applied to this schema (since Version 03, Februar, 2008):
	- Februar, 2008
	- version changed to 04.
	
	- changed namespace (both xmlns and targetNamespace)
	from  http://www.escidoc.de/schemas/components/0.4
	to http://www.escidoc.de/schemas/components/0.4
	-changed namespaces of refered schemas:
	from http://www.escidoc.de/schemas/metadatarecords/0.3
	to http://www.escidoc.de/schemas/metadatarecords/0.4
	from http://www.escidoc.de/schemas/commontypes/0.3
	to http://www.escidoc.de/schemas/commontypes/0.4
	- refered new schemas with namespaces:
	xmlns:prop="http://escidoc.de/core/01/properties/
	xmlns:srel="http://escidoc.de/core/01/structural-relations/
-->

<xs:schema attributeFormDefault="unqualified"
	elementFormDefault="qualified"
	targetNamespace="http://www.escidoc.de/schemas/components/0.4"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:relations="http://www.escidoc.de/schemas/relations/0.3"
	xmlns:md-records="http://www.escidoc.de/schemas/metadatarecords/0.4"
	xmlns:components="http://www.escidoc.de/schemas/components/0.4"
	xmlns:common-types="http://www.escidoc.de/schemas/commontypes/0.4"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:prop="http://escidoc.de/core/01/properties/"
	xmlns:srel="http://escidoc.de/core/01/structural-relations/">

	<xs:import namespace="http://escidoc.de/core/01/properties/"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.4/properties.xsd" />
	<xs:import
		namespace="http://escidoc.de/core/01/structural-relations/"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.4/structural-relations.xsd" />
	<xs:import namespace="http://www.w3.org/1999/xlink"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.3/xlink.xsd" />
	<xs:import
		namespace="http://www.escidoc.de/schemas/metadatarecords/0.4"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.4/md-records.xsd" />
	<xs:import namespace="http://www.w3.org/XML/1998/namespace"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.3/xml.xsd" />
	<xs:import namespace="http://www.escidoc.de/schemas/commontypes/0.4"
		schemaLocation="http://www.escidoc.org/schemas/rest/common/0.4/common-types.xsd" />

	<xs:element name="components">
		<xs:annotation>
			<xs:documentation>
				<para>
					Following you will find information which elements
					and attributes are "required", "optional",
					"not-allowed" or will be "discarded" in the input
					XML-stream when creating or updating such an object.
				</para>
				<para>
					In "create" the rule for creating a new object is
					defined.
				</para>
				<para>
					In "update" the rule for updating an object is
					defined.
				</para>
				<para>
					Possible values are: required | optional |
					not-allowed | discarded
				</para>
				<para>
					required: this element or attribute has to be
					delivered
				</para>
				<para>
					optional: this element or attribute can be delivered
					and will be kept
				</para>
				<para>
					not-allowed: this element or attribute is not
					allowed in delivery and will cause an exception
				</para>
				<para>
					discarded: this element or attribute can be
					delivered but will not be used
				</para>
			</xs:documentation>

			<xs:documentation>
				<create>required</create>
				<update>required</update>
			</xs:documentation>
		</xs:annotation>

		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded"
					ref="components:component">
				</xs:element>
			</xs:sequence>

			<xs:attributeGroup
				ref="common-types:eSciDocResourceIdentityAttributes">
			</xs:attributeGroup>
			<xs:attributeGroup
				ref="common-types:eSciDocRootElementAttributes" />

		</xs:complexType>
	</xs:element>

	<xs:element name="component">
		<xs:annotation>
			<xs:documentation>
				<create>optional</create>
				<update>optional (see comment)</update>
				<comment>
					if not present in XML-stream and exists in stored
					object this component will be deleted.
				</comment>
			</xs:documentation>
		</xs:annotation>

		<xs:complexType>
			<xs:sequence>
				<xs:element ref="components:properties"></xs:element>

				<xs:element name="content">
					<xs:annotation>
						<xs:documentation>
							<create>optional</create>
							<update>optional (see comment)</update>
							<comment>
								if not present in XML-stream and exists
								in stored object this content will be
								deleted.
							</comment>
						</xs:documentation>
					</xs:annotation>

					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute ref="xlink:type"
									fixed="simple">
									<xs:annotation>
										<xs:documentation>
											<create>discarded</create>
											<update>discarded</update>
										</xs:documentation>
									</xs:annotation>
								</xs:attribute>
								<xs:attribute ref="xlink:title">
									<xs:annotation>
										<xs:documentation>
											<create>discarded</create>
											<update>discarded</update>
										</xs:documentation>
									</xs:annotation>
								</xs:attribute>
								<xs:attribute ref="xlink:href">
									<xs:annotation>
										<xs:documentation>
											<create>optional</create>
											<update>optional</update>
										</xs:documentation>
									</xs:annotation>
								</xs:attribute>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>

				<xs:element minOccurs="0" ref="md-records:md-records" />
			</xs:sequence>

			<xs:attributeGroup
				ref="common-types:eSciDocResourceIdentityAttributes" />
			<xs:attributeGroup
				ref="common-types:eSciDocRootElementAttributes">
			</xs:attributeGroup>
		</xs:complexType>
	</xs:element>

	<xs:element name="properties">
		<xs:annotation>
			<xs:documentation>
				<create>required</create>
				<update>required</update>
			</xs:documentation>
		</xs:annotation>

		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" ref="prop:creation-date">
					<xs:annotation>
						<xs:documentation>
							<create>discarded</create>
							<update>discarded</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element minOccurs="0" ref="srel:created-by">
					<xs:annotation>
						<xs:documentation>
							<create>discarded</create>
							<update>discarded</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element minOccurs="0" ref="prop:description">
					<xs:annotation>
						<xs:documentation>
							<create>optional</create>
							<update>optional</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element ref="prop:valid-status">
					<xs:annotation>
						<xs:documentation>
							<create>required</create>
							<update>required</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element ref="prop:visibility">
					<xs:annotation>
						<xs:documentation>
							<create>required</create>
							<update>required</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element minOccurs="0" ref="prop:pid">
					<xs:annotation>
						<xs:documentation>
							<create>discarded</create>
							<update>discarded</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element ref="prop:content-category">
					<xs:annotation>
						<xs:documentation>
							<create>required</create>
							<update>required</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element ref="prop:file-name">
					<xs:annotation>
						<xs:documentation>
							<create>required</create>
							<update>required</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element minOccurs="0" ref="prop:mime-type">
					<xs:annotation>
						<xs:documentation>
							<create>optional</create>
							<update>optional</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element ref="prop:file-size">
					<xs:annotation>
						<xs:documentation>
							<create>required</create>
							<update>required</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>

				<xs:element minOccurs="0" ref="prop:locator-url">
					<xs:annotation>
						<xs:documentation>
							<create>optional</create>
							<update>optional</update>
						</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>

			<xs:attributeGroup
				ref="common-types:eSciDocResourceIdentityAttributes" />
			<xs:attributeGroup
				ref="common-types:eSciDocRootElementAttributes" />

		</xs:complexType>
	</xs:element>
</xs:schema>