<?xml version="1.0" encoding="utf-8"?>
<!-- <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd"> -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://sobekrepository.org/schemas/sobekcm_map/" 
	targetNamespace="http://sobekrepository.org/schemas/sobekcm_map/"
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified" 
	xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
	version="0.0">

  <xs:annotation>
    <xs:documentation xml:lang="en">
		    Written by Mark Sullivan (March 2007)
			Schema defining metadata elements to be used to describe a complex map
			set, with references to indexes, entities, and sheets.  This schema
			can be used as a stand-along XML file or can be encorporated into the 
			METS files in the bibDesc section.
	</xs:documentation>
  </xs:annotation>
	
  <!-- Main element of a conforming XML file.  'sobek_map' holds all the data about -->
  <!-- the map, to be used during ingest and display in UFDC. -->
  <xs:element name="sobek_map">
    <xs:complexType>
      <xs:sequence>
      
        <!-- Index information for this map set -->
        <xs:element name="indexes" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="image" type="sobek_map_index" />
            </xs:choice>
          </xs:complexType>
        </xs:element>
        
        <!-- Entities which appear on this map set.  Currently entities are just -->
        <!-- streets and features, with links to corporations and people -->
        <xs:element name="entities" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
			  <xs:element name="street" type="sobek_map_street" />
              <xs:element name="feature" type="sobek_map_feature" />
              <xs:element name="corporation" type="sobek_map_corp" />
              <xs:element name="person" type="sobek_map_person" />
            </xs:choice>
          </xs:complexType>
        </xs:element>
        
        <!-- Sheet references used for the sheet links -->
        <xs:element name="sheets" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="sheet" type="sobek_map_sheet" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" />
      <xs:attribute name="date" type="xs:string" />
    </xs:complexType>
  </xs:element>
  
  <!-- Complex sobek_MAP_INDEX type used to provide information about indexes for the map set -->
   <xs:complexType name="sobek_map_index">
     <xs:sequence>
       <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1" />
       <xs:element name="file" type="xs:string" minOccurs="0" maxOccurs="1" />
       <xs:element name="html" type="xs:string" minOccurs="0" maxOccurs="1" />
     </xs:sequence>
     <xs:attribute name="type" >
       <xs:simpleType>
         <xs:restriction base="xs:NMTOKEN">
           <xs:enumeration value="static" /> 
           <xs:enumeration value="zoom" /> 
         </xs:restriction>
       </xs:simpleType>
     </xs:attribute>
     <xs:attribute name="id" type="xs:string" />
   </xs:complexType>
                
   <!-- Complex sobek_MAP_STREET type holds information about streets which appear on the map set -->
   <xs:complexType name="sobek_map_street">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="segment">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="sheetid" type="xs:string" />
                  <xs:attribute name="start" type="xs:integer" />
                  <xs:attribute name="end" type="xs:integer" />
                  <xs:attribute name="direction" type="xs:string" />
                  <xs:attribute name="side" type="xs:string" />
                </xs:extension>
			  </xs:simpleContent>
            </xs:complexType>
        </xs:element>
        </xs:choice>
        <xs:attribute name="id" type="xs:string" />
        <xs:attribute name="name" type="xs:string" />
    </xs:complexType>
    
    <!-- Complex sobek_MAP_FEATURE type holds information about features which appear on the map set -->
    <xs:complexType name="sobek_map_feature">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
        
        <!-- Reference to a corporate body -->
        <xs:element name="corpref" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
            <xs:attribute name="corpid" type="xs:string" />
            </xs:complexType>
        </xs:element>
        
        <!-- Reference to a person -->
        <xs:element name="persref" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
            <xs:attribute name="persid" type="xs:string" />
            <xs:attribute name="reftype" type="xs:string" />
            </xs:complexType>
        </xs:element>
        
        <!-- Location information for this feature -->
        <xs:element name="location" minOccurs="0" maxOccurs="1">
            <xs:complexType>
            <xs:sequence>
                <xs:element name="desc" type="xs:string" minOccurs="0" maxOccurs="1" />
                <xs:element name="coordinates" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                    <xs:attribute name="units" type="xs:string" />
                    <xs:attribute name="latitude" type="xs:string" />
                    <xs:attribute name="longitude" type="xs:string" />
                </xs:complexType>
                </xs:element>
                <xs:element name="sheetref" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="sheetid" type="xs:string" />
                    <xs:attribute name="x" type="xs:integer" />
                    <xs:attribute name="y" type="xs:integer" />
                </xs:complexType>
                </xs:element>
            </xs:sequence>
            </xs:complexType>
        </xs:element>
        </xs:choice>
        
        <xs:attribute name="id" type="xs:string" />
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="type" type="xs:string" />
    </xs:complexType>
    
    <!-- Complex sobek_MAP_CORP type holds information about corporations which are -->
    <!-- linked to features which appear on the map set -->
	<xs:complexType name="sobek_map_corp">
	  <xs:choice>
		<xs:element name="corpname" minOccurs="0" maxOccurs="unbounded">
			<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
				<xs:attribute name="type" default="primary">
				  <xs:simpleType>
                    <xs:restriction base="xs:NMTOKEN">
                      <xs:enumeration value="primary" /> 
                      <xs:enumeration value="alternate" /> 
                    </xs:restriction>
                  </xs:simpleType>
				</xs:attribute>
				</xs:extension>
			</xs:simpleContent>
			</xs:complexType>
		</xs:element>
	  </xs:choice>
	  <xs:attribute name="id" type="xs:string" />
	</xs:complexType>
	
    <!-- Complex sobek_MAP_PERSON type holds information about people which are -->
    <!-- linked to features which appear on the map set -->
	<xs:complexType name="sobek_map_person">
      <xs:sequence>
        <xs:element name="persname" type="xs:string" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" />
    </xs:complexType>
    
    <!-- Complex sobek_MAP_SHEET holds information for linking entities back -->
    <!-- to individual sheets in this map set -->
    <xs:complexType name="sobek_map_sheet">
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="fileref" minOccurs="0" maxOccurs="1">
            <xs:complexType>
              <xs:attribute name="fileid" type="xs:string" />
            </xs:complexType>
        </xs:element>
        <xs:element name="ufdcref" minOccurs="0" maxOccurs="1">
            <xs:complexType>
              <xs:attribute name="index" type="xs:integer" />
            </xs:complexType>
        </xs:element>
      </xs:choice>
      <xs:attribute name="id" type="xs:string" />
    </xs:complexType>
</xs:schema>