<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.blackperl.com/XML/ChangeLog"
    targetNamespace="http://www.blackperl.com/XML/ChangeLog"
    elementFormDefault="qualified" attributeFormDefault="unqualified"
    version="0.93" id="changelog0.93">
  <!--
      Refer to this schema using the following namespace:
      http://www.blackperl.com/XML/ChangeLog
  -->
  <xsd:annotation>
    <xsd:documentation>
      A description of an XML application which itemizes changes over the
      life-span of a software project. Changes are tracked by releases, with a
      granularity of individual items made up of files that were affected.
    </xsd:documentation>
    <xsd:appinfo xmlns:dc="http://purl.org/dc/elements/1.1/">
      <dc:creator>Randy J. Ray (rjray@blackperl.com)</dc:creator>
      <dc:date>2004-11-22</dc:date>
      <dc:subject>changelog,xml,schema</dc:subject>
      <dc:description>
        An XML Schema declaration describing an XML expression of software
        project change-logs.
      </dc:description>
    </xsd:appinfo>
    <xsd:appinfo>
      <rdf:RDF xmlns:cc="http://web.resource.org/cc/"
               xmlns:dc="http://purl.org/dc/elements/1.1/"
               xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
        <cc:Work rdf:about="">
          <dc:title>XML Schema for Changelogs</dc:title>
          <dc:description>
            An XML Schema declaration describing an XML expression of software
            project change-logs.
          </dc:description>
          <dc:creator>
            <cc:Agent>
              <dc:title>Randy J. Ray</dc:title>
            </cc:Agent>
          </dc:creator>
          <dc:rights>
            <cc:Agent>
              <dc:title>Randy J. Ray</dc:title>
            </cc:Agent>
          </dc:rights>
          <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
          <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
        </cc:Work>
        <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
          <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" />
          <cc:permits rdf:resource="http://web.resource.org/cc/Distribution" />
          <cc:requires rdf:resource="http://web.resource.org/cc/Notice" />
          <cc:requires rdf:resource="http://web.resource.org/cc/Attribution" />
          <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
          <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
        </cc:License>
      </rdf:RDF>
    </xsd:appinfo>
  </xsd:annotation>

  <xsd:complexType id="informationType" name="informationType"
                   mixed="true">
    <xsd:annotation>
      <xsd:documentation>
        An open-ended container type for including version-control information
        at various levels within the changelog structure. This is the only
        type which explicitly permits content from foreign namespaces.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence maxOccurs="unbounded" minOccurs="0">
      <xsd:any processContents="lax" />
    </xsd:sequence>
    <xsd:attribute name="source" type="xsd:anyURI" />
    <xsd:anyAttribute namespace="##other" processContents="lax" />
  </xsd:complexType>

  <xsd:complexType id="descriptionType" name="descriptionType">
    <xsd:annotation>
      <xsd:documentation>
        A description block is used to document everything from specific change
        items to the release as a whole.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute default="en-US" name="lang" type="xsd:language" />
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:simpleType id="versionString" name="versionString">
    <xsd:annotation>
      <xsd:documentation>
        The versionString type is applied to attributes that describe simple
        revision-number strings. It only supports CVS (RCS) styled version
        numbers.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d+(\.\d+)*" />
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType id="fileType" name="fileType">
    <xsd:annotation>
      <xsd:documentation>
        The fileType definition is used for the file element, a part of the
        itemType declaration. It is defined separately so that it can be
        referred to from multiple places.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence maxOccurs="1" minOccurs="0">
      <xsd:element name="description" type="tns:descriptionType"
                   minOccurs="0" maxOccurs="unbounded" />
      <xsd:element maxOccurs="1" minOccurs="0" name="vc-information"
                   type="tns:informationType" nillable="true" />
    </xsd:sequence>
    <xsd:attribute name="path" type="xsd:string" use="required" />
    <xsd:attribute name="revision" type="tns:versionString" use="optional"/>
    <xsd:attribute name="author" type="xsd:NMTOKEN" use="optional" />
    <xsd:attribute name="action" use="optional">
      <xsd:simpleType>
        <xsd:restriction base="xsd:NMTOKEN">
          <xsd:enumeration value="ADD" />
          <xsd:enumeration value="DELETE" />
          <xsd:enumeration value="RESTORE" />
          <xsd:enumeration value="MOVE" />
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>
    <xsd:attribute name="note" type="xsd:string" use="optional" />
  </xsd:complexType>

  <xsd:element id="file" name="file" nillable="true" type="tns:fileType">
    <xsd:annotation>
      <xsd:documentation>
        A file element contains a single block representing a fileType.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="fileDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

  <xsd:complexType id="itemType" name="itemType">
    <xsd:annotation>
      <xsd:documentation>
        These element blocks define a single change-item within the scope of a
        given release. A change-item consists of one or more files that were
        affected, and a description of the change itself.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element maxOccurs="1" minOccurs="0" name="vc-information"
                   type="tns:informationType" nillable="true" />
      <xsd:choice minOccurs="1" maxOccurs="1">
        <xsd:element ref="tns:file" />
        <xsd:element name="fileset" nillable="false">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element maxOccurs="1" minOccurs="0" name="vc-information"
                           type="tns:informationType" nillable="true" />
              <xsd:element maxOccurs="unbounded" minOccurs="1" ref="tns:file" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:choice>
      <xsd:element name="description" type="tns:descriptionType"
                   minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:ID" />
  </xsd:complexType>

  <xsd:element id="item" name="item" nillable="false" type="tns:itemType">
    <xsd:annotation>
      <xsd:documentation>
        An item element contains a single block representing an itemType.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="itemDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

  <xsd:complexType id="releaseType" name="releaseType">
    <xsd:annotation>
      <xsd:documentation>
        The release is the primary piece of information that a changelog
        collects and organizes. A release contains an optional description,
        followed by one or more item blocks. The release element is also the
        greatest user of attributes besides the file element. A release element
        must have at least a "version" attribute, uniquely identifying the
        release itself. Additionally, it may have "tag" to associate it with
        a release-system tag and "date" to specify the date the release was
        created.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="description" type="tns:descriptionType"
                   minOccurs="0" maxOccurs="unbounded" />
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="information"
                   type="tns:informationType" nillable="true" />
      <xsd:element maxOccurs="1" minOccurs="0" name="vc-information"
                   type="tns:informationType" nillable="true" />
      <xsd:element maxOccurs="unbounded" minOccurs="1" ref="tns:item" />
    </xsd:sequence>
    <xsd:attribute name="version" type="xsd:token" use="required" />
    <xsd:attribute name="tag" type="xsd:NMTOKEN" />
    <xsd:attribute name="date" type="xsd:token" use="required" /> <!-- type="xsd:dateTime"  -->
  </xsd:complexType>

  <xsd:element id="release" name="release" nillable="false"
               type="tns:releaseType">
    <xsd:annotation>
      <xsd:documentation>
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="releaseDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

  <xsd:element id="changelog" name="changelog" nillable="false">
    <xsd:annotation>
      <xsd:documentation>
        The changelog element is intended as the document root element. It
        contains an overview element (identical in structure to the description
        element, but named differently to prevent collision in XPath queries)
        and one or more release blocks.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="unbounded" minOccurs="1" name="description"
                     nillable="false" type="tns:descriptionType" />
        <xsd:element maxOccurs="unbounded" minOccurs="0" name="information"
                   type="tns:informationType" nillable="true" />
        <xsd:element maxOccurs="1" minOccurs="0" name="vc-information"
                     type="tns:informationType" nillable="true" />
        <xsd:element maxOccurs="unbounded" minOccurs="1" ref="tns:release" />
      </xsd:sequence>
    </xsd:complexType>
    <xsd:unique name="changelogDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

</xsd:schema>

