<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!-- =============== Cocoon Sitemap Working Draft ============================

This document contains an example used as a working draft for 
Cocoon architects to test and understand the issues associated with 
sitemaps and XML publishing in general. It must be considered as a working 
draft and may be updated at any time.

============================================================================ -->

<schema xmlns="http://www.w3.org/1999/XMLSchema"
        xmlns:map="http://apache.org/cocoon/sitemap/1.0"
        targetNamespace="http://apache.org/cocoon/sitemap/1.0">

	<complexType name="groupType">
		<!-- 
		  Is it possible to have the type be an enumeration of the 
		  values of the children's type attribute? 
	   -->
		<attribute name="default" type="string" use="required"/>
	</complexType>

	<complexType name="componentType" base="string">
		<!-- Anything goes for parameter values... -->
		<any minOccurs="0" maxOccurs="unbounded"/>
		<attribute name="type" type="string" use="required"/>
		<attribute name="src" type="uriReference" use="required"/>
		<attribute name="label" type="string"/>
	</complexType>

	<complexType name="actionType">
		<attribute name="type" type="string" use="optional"/>
		<attribute name="src" type="uriReference" use="optional"/>
	</complexType>

	<complexType name="generateType">
		<element name="generate" minOccurs="1" maxOccurs="1" type="map:actionType"/>
	</complexType>

	<complexType name="actionTypes">
		<sequence>
			<element name="generate" minOccurs="1" maxOccurs="1" type="map:actionType"/>
			<element name="transform" minOccurs="0" maxOccurs="unbounded" type="map:actionType"/>
			<element name="serialize" minOccurs="1" maxOccurs="1">
				<complexType base="map:actionType">
					<attribute name="status-code" type="short"/>
				</complexType>
			</element>
		</sequence>
	</complexType>

	<complexType name="matchType">
		<attribute name="type" type="string" use="optional"/>
		<attribute name="pattern" type="string" use="required"/>
	</complexType>

	<element name="sitemap" minOccurs="1" maxOccurs="1">
		<complexType>
			<element name="components" minOccurs="1" maxOccurs="1">
				<complexType>
					<element name="generators" minOccurs="1" maxOccurs="1">
						<complexType base="map:groupType">
							<element name="generator" minOccurs="1" maxOccurs="unbounded" type="map:componentType"/>
						</complexType>
					</element>
					<element name="transformers" minOccurs="0" maxOccurs="1">
						<complexType base="map:groupType">
							<element name="transformer" minOccurs="1" maxOccurs="unbounded" type="map:componentType"/>
						</complexType>
					</element>
					<element name="serializers" minOccurs="1" maxOccurs="1">
						<complexType base="map:groupType">
							<element name="serializer" minOccurs="1" maxOccurs="unbounded">
								<complexType base="map:componentType">
									<attribute name="mime-type" type="string"/>
								</complexType>
							</element>
						</complexType>
					</element>
					<element name="choosers" minOccurs="0" maxOccurs="1">
						<complexType base="map:groupType">
							<element name="chooser" minOccurs="1" maxOccurs="unbounded" type="map:componentType"/>
						</complexType>
					</element>
					<element name="matchers" minOccurs="0" maxOccurs="1">
						<complexType base="map:groupType">
							<element name="matcher" minOccurs="1" maxOccurs="unbounded" type="map:componentType"/>
						</complexType>
					</element>
				</complexType>
			</element>
			<!-- end components -->
			<element name="views" minOccurs="0" maxOccurs="1">
				<complexType>
					<element name="view" minOccurs="1" maxOccurs="unbounded">
						<complexType>
							<element name="transform" minOccurs="0" maxOccurs="unbounded" type="map:actionType"/>
							<element name="serialize" minOccurs="1" maxOccurs="1" type="map:actionType"/>
							<attribute name="name" type="string" use="required"/>
							<attribute name="generate-from" type="string" use="required"/>
						</complexType>
					</element>
				</complexType>
			</element>
			<element name="resources" minOccurs="0" maxOccurs="1">
				<complexType>
					<element name="resource" minOccurs="1" maxOccurs="unbounded">
						<complexType base="map:actionTypes">
							<attribute name="name" type="string" use="required"/>
						</complexType>
					</element>
				</complexType>
			</element>
			<element name="pipelines" minOccurs="0" maxOccurs="1">
				<complexType>
					<element name="pipeline" minOccurs="1" maxOccurs="unbounded">
						<complexType>
							<element name="match" minOccurs="1" maxOccurs="unbounded">
								<complexType base="map:matchType"/>
							</element>
						</complexType>
					</element>
				</complexType>
			</element>
		</complexType>
	</element>
</schema>
