<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.openarchives.org/rs/terms/"
            xmlns="http://www.openarchives.org/rs/terms/"
            elementFormDefault="qualified">

  <xsd:annotation>
    <xsd:documentation>
      XML Schema for ResoureSync extensions to Sitemap files.
      Simeon Warner 
      Created: 2013-01-06
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="md">
    <xsd:annotation>
      <xsd:documentation>
	Metadata about a resource
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:restriction base="xsd:anyType">
          <xsd:attribute name="capability" type="xsd:string"/>
          <xsd:attribute name="change" type="changeType"/>
          <xsd:attribute name="modified" type="xsd:dateTime"/>
          <xsd:attribute name="hash" type="xsd:string"/>
          <xsd:attribute name="length" type="xsd:integer"/>
          <xsd:attribute name="path" type="pathType"/>
          <xsd:attribute name="type" type="contentType"/>
        </xsd:restriction>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="ln">
    <xsd:annotation>
      <xsd:documentation>
	Links to other related resources
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:restriction base="xsd:anyType">
          <xsd:attribute name="rel" type="xsd:string"/>
          <xsd:attribute name="href" type="xsd:anyURI"/>
          <xsd:attribute name="modified" type="xsd:dateTime"/>
          <xsd:attribute name="hash" type="xsd:string"/>
          <xsd:attribute name="length" type="xsd:nonNegativeInteger"/>
          <xsd:attribute name="path" type="pathType"/>
          <xsd:attribute name="type" type="contentType"/>
          <xsd:attribute name="pri" type="priType"/>
        </xsd:restriction>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

  <xsd:simpleType name="changeType">
    <xsd:annotation>
      <xsd:documentation>
        Allowed values of the change attribute are
	created, updated, deleted
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="created"/>
      <xsd:enumeration value="updated"/>
      <xsd:enumeration value="deleted"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="pathType">
    <xsd:annotation>
      <xsd:documentation>
        Path values must start with a slash, must not end with a slash
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="/.*[^/]"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="contentType">
    <xsd:annotation>
      <xsd:documentation>
        MIME Content Types are described in RFCs 2045,2046
        http://tools.ietf.org/html/rfc2045
        http://tools.ietf.org/html/rfc2046
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[\w-]+/[\w-]+"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="priType">
    <xsd:annotation>
      <xsd:documentation>
        The priority attribute may have values 1 through 999999
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:integer">
      <xsd:minInclusive value="1"/>
      <xsd:maxInclusive value="999999"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>
