<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.blackperl.com/XML/ChangeLog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    targetNamespace="http://www.blackperl.com/XML/ChangeLog"
    elementFormDefault="qualified" attributeFormDefault="unqualified"
    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
    version="0.95" id="changelog0.95">
  <!--
      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 &lt;rjray@blackperl.com&gt;</dc:creator>
      <dc:date>2008-10-10</dc:date>
      <dc:subject>changelog,xml,schema</dc:subject>
      <dc:description>
        An XML Schema declaration describing an XML vocabulary for 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 vocabulary for 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="tns:informationType">
        <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 dotted-decimal 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
        changeType 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="version-control"
                   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:complexType>

  <xsd:element id="file" name="file" nillable="true" type="tns:fileType">
    <xsd:annotation>
      <xsd:documentation>
        A file element represents one changed file in the containing "change"
        element.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="fileDescriptionLangConstraint">
      <xsd:selector xpath="tns:description" />
      <xsd:field xpath="@lang" />
    </xsd:unique>
  </xsd:element>

  <xsd:complexType id="changeType" name="changeType">
    <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="version-control"
                           type="tns:informationType" nillable="true" />
              <xsd:element maxOccurs="unbounded" minOccurs="1" ref="tns:file" />
            </xsd:sequence>
          </xsd:complexType>
          <xsd:attribute name="revision" type="tns:versionString"
                         use="optional"/>
        </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="change" name="change" nillable="false" type="tns:changeType">
    <xsd:annotation>
      <xsd:documentation>
        A change element defines one change within a release. The change itself
        may span several files, but the single description within the change
        is relevant to all file-references contained within.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:unique name="changeDescriptionLangConstraint">
      <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 change 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="version-control"
                   type="tns:informationType" nillable="true" />
      <xsd:element maxOccurs="unbounded" minOccurs="1" name="change"
                   type="tns:changeType" />
    </xsd:sequence>
    <xsd:attribute name="version" type="xsd:token" use="required" />
    <xsd:attribute name="tag" type="xsd:NMTOKEN" />
    <xsd:attribute name="date" type="xsd:dateTime" use="required" />
  </xsd:complexType>

  <xsd:element id="release" name="release" nillable="false"
               type="tns:releaseType">
    <xsd:annotation>
      <xsd:documentation>
        The release element details one release within the overall change-log
        itself. Because the release element has a required attribute that
        provides a time-stamp, releases may appear in any order within the
        change-log, since processors can sort the elements by their relative
        dates.
      </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 a description element 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="version-control"
                     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>