<?xml version="1.0" standalone="no"?>


<!--
+==========================================================================+
|  NAME: rfc-index.xsd							   |
|									   |
|  DESCRIPTION:								   |
|	This XML schema is used to describe a complete RFC Index.  It	   |
|	includes structures for RFC, sub-series (STD, BCP, FYI), and Not   |
|	Issued RFC entries.  Datatypes and structures have been documented |
|	through the use of in-line comments.		  		   |
|									   |
|	Any questions or suggestions for improvement should be directed to |
|	the RFC Editor staff at rfc-editor@rfc-editor.org.		   |
|									   |
|  DRAFT DATE: February 10, 2003					   |
|									   |
|  HISTORY:								   |
|       2003-11-05:Created defined datatype dayOfMonth to be used in place | 
|                  of gDay for day fields- Gordon Thomas <gjthomas@isi.edu>|
|                                                                          |
|	2003-02-10:Created by Nathalie Collins <collins@isi.edu>.	   |
|		   Based upon a DTD created by Tony Hansen, Bob Braden,    |
|		   and Dong-Jin Son - ISI (RFC Editor).		           |
|									   |
+==========================================================================+
-->

<xsd:schema targetNamespace="http://www.rfc-editor.org/rfc-index" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.rfc-editor.org/rfc-index" elementFormDefault="qualified" attributeFormDefault="unqualified">

    <!--
	|| Notes on datatypes:
	||
	|| In order to maintain data consistency in resulting instance
	|| documents, a set of custom datatypes have been created.
	||
	|| documentId:	A unique ID created through concatenation of the
	||		document type with its numeric identifier.  It is
	||		required to conform to patterns confining its prefix
	||		and length.  RFC, STD, BCP, and FYI documents are
	||		described within this index.  NIC, IEN, and RTR
	||		types have been used in external references.  (See
	||		description of <see-also> element).
	||
	|| status:	An enumerated list of status types (or categories). 
	||		See RFC2026 for more information.  This datatype is
	||		used to describe <current-status> and
	||		<publication-status> within an RFC entry.
	||
	|| fileFormat:	Enumerated list describing the possible
	||		RFC/sub-series document formats.  Current types
	||		include ASCII, PDF, and PS.  Note that this field
	||		may be expanded upon in the future.
	||
	|| monthName:	An enumerated list of fully spelled out month names
	||		as they appear in RFC dates.
	||
	|| documentRef:	Elements of this type serve as links to other
	||		documents contained both within this index and
	||		externally.  They point to one or more document IDs.
	||
    -->

    <!-- Definition of a document ID; example: RFC0015 -->
    <xsd:simpleType name="documentId">
	<xsd:restriction base="xsd:string">
	    <xsd:pattern value="RFC\d{4}"/>
	    <xsd:pattern value="STD\d{4}"/>
	    <xsd:pattern value="BCP\d{4}"/>
	    <xsd:pattern value="FYI\d{4}"/>
	    <xsd:pattern value="NIC\d{4,5}"/>
	    <xsd:pattern value="IEN\d{2,3}"/>
	    <xsd:pattern value="RTR\d{3,4}"/>
	</xsd:restriction>
    </xsd:simpleType>

    <!-- Enumerated list of status types -->
    <xsd:simpleType name="status">
	<xsd:restriction base="xsd:string">
	    <xsd:enumeration value="STANDARD"/>
	    <xsd:enumeration value="DRAFT STANDARD"/>
	    <xsd:enumeration value="PROPOSED STANDARD"/>
	    <xsd:enumeration value="UNKNOWN"/>
	    <xsd:enumeration value="BEST CURRENT PRACTICE"/>
	    <xsd:enumeration value="FOR YOUR INFORMATION"/>
	    <xsd:enumeration value="EXPERIMENTAL"/>
	    <xsd:enumeration value="HISTORIC"/>
	    <xsd:enumeration value="INFORMATIONAL"/>
	</xsd:restriction>
    </xsd:simpleType>

    <!-- Enumerated list of available file types -->
    <xsd:simpleType name="fileFormat">
	<xsd:restriction base="xsd:string">
	    <xsd:enumeration value="ASCII"/>
	    <xsd:enumeration value="PS"/>
	    <xsd:enumeration value="PDF"/>
	</xsd:restriction>
    </xsd:simpleType>

    <!-- Days of the Month -->
    <xsd:simpleType name="dayOfMonth">
       <xsd:restriction base="xsd:integer">
           <xsd:minInclusive value="1" />
           <xsd:maxInclusive value="31" />
           <xsd:pattern value="\d{2}" />
       </xsd:restriction>
    </xsd:simpleType>

    <!-- Months of the year -->
    <xsd:simpleType name="monthName">
	<xsd:restriction base="xsd:string">
	    <xsd:enumeration value="January"/>
	    <xsd:enumeration value="February"/>
	    <xsd:enumeration value="March"/>
	    <xsd:enumeration value="April"/>
	    <xsd:enumeration value="May"/>
	    <xsd:enumeration value="June"/>
	    <xsd:enumeration value="July"/>
	    <xsd:enumeration value="August"/>
	    <xsd:enumeration value="September"/>
	    <xsd:enumeration value="October"/>
	    <xsd:enumeration value="November"/>
	    <xsd:enumeration value="December"/>
	</xsd:restriction>
    </xsd:simpleType>

    <!-- Type used for linking to other documents -->
    <xsd:complexType name="documentRef">
	<xsd:sequence>
	    <xsd:element name="doc-id" type="documentId" maxOccurs="unbounded"/>
	</xsd:sequence>
    </xsd:complexType>

    <!--
	|| Notes on reusable elements:
	||
	|| For the purpose of readability, certain moderately complex
	|| element definitions have been pulled out of the <rfc-entry>
	|| container below.  They have been defined here and pulled in
	|| through 'ref' attributes when needed.
	||
	|| author: 	This element defines an author entity as it applies
	||		to a specific RFC document.  The generic 'name'
	||		field can either contain the name of an individual
	||		or an authoring organization.  All other fields are
	||		used to provide further information about the entity
	||		named in <name>.
	||
	||		The <organization> element states the author's
	||		organization while the <org-abbrev> field states the
	||		same information in abbreviated form (as it appears
	||		in the RFC itself).
	||
	|| date:	This structure is used to represent the publication
	||		date of an RFC document.  The day of the month is an
	||		optional field as it is not known for all RFCs.
	||
	|| format:	This element is used to describe a particular format
	||		in which a document appears.  Each document may be
	||		available in more than one format.  Each
	||		'file-format' has an associated character count and
	||		page count (where available).
	||
	|| keywords:	This serves as a container for an unlimited number
	||		of <kw> elements, each of which hold a keyword
	||		describing the given document.
	||
    -->
    <!-- Author representation -->
    <xsd:element name="author">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="name" type="xsd:string"/>
		<xsd:element name="title" type="xsd:string" minOccurs="0"/>
		<xsd:element name="organization" type="xsd:string" minOccurs="0"/>
		<xsd:element name="org-abbrev" type="xsd:string" minOccurs="0"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!-- Date representation -->
    <xsd:element name="date">
	<xsd:complexType>
	    <xsd:all>
		<xsd:element name="month" type="monthName"/>
		<xsd:element name="day" type="dayOfMonth" minOccurs="0"/>
		<xsd:element name="year" type="xsd:gYear"/>
	    </xsd:all>
	</xsd:complexType>
    </xsd:element>

    <!-- Information regarding each file format -->
    <xsd:element name="format">
	<xsd:complexType>
	    <xsd:all>
		<xsd:element name="file-format" type="fileFormat"/>
		<xsd:element name="char-count" type="xsd:nonNegativeInteger"/>
		<xsd:element name="page-count" type="xsd:nonNegativeInteger" minOccurs="0"/>
	    </xsd:all>
	</xsd:complexType>
    </xsd:element>

    <!-- Searchable keywords pertaining to a document entry -->
    <xsd:element name="keywords">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="kw" type="xsd:string" maxOccurs="unbounded"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!--
	|| Notes on STD, BCP, and FYI entries:
	||
	|| The STD sub-series is currently unique in allowing one STD to
	|| include multiple RFC components (hence, 'is-also').  However, the
	|| syntax also allows multiple RFCs for the other sub-series.  An
	|| STD may have a title that differs from the titles of any of its
	|| components.
	||
	|| doc-id:	The document identifier string.  Refer to notes on
	||		RFC entry for more detailed description.
	||
	|| title:	Title describing grouping of documents associated
	||		with this label.  Note that we are currently only
	||		using this field for STD entries.  It has been
	||		included as an optional field in BCP and FYI entries
	||		to allow for future expansion.
	||
	|| is-also:	Reference back to RFC(s) that make up this
	||		sub-series entry.
	||
    -->

    <!-- structure for STD (standard) documents -->
    <xsd:element name="std-entry">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="doc-id" type="documentId"/>
		<xsd:element name="title" type="xsd:string"/>
		<xsd:element name="is-also" type="documentRef" minOccurs="0"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!-- structure for BCP (best current practice) documents -->
    <xsd:element name="bcp-entry">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="doc-id" type="documentId"/>
		<xsd:element name="title" type="xsd:string" minOccurs="0"/>
		<xsd:element name="is-also" type="documentRef" minOccurs="0"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!-- structure for FYI (for your information) documents -->
    <xsd:element name="fyi-entry">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="doc-id" type="documentId"/>
		<xsd:element name="title" type="xsd:string" minOccurs="0"/>
		<xsd:element name="is-also" type="documentRef" minOccurs="0"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!--
	|| Notes on elements of RFC entry:
	||
	|| doc-id: 	The document identifier string, in the form:
	||		doc-id ::= RFC<integer> | STD<integer> |
	||			   BCP<integer> | FYI<integer>
	||		where 'integer' is required to be 4 digits.
	||
	|| is-also:	In RFC entry, reference to sub-series (STD, BCP, or
	||		FYI entr(ies).  In sub-series entry, reference back
	||		to RFC entr(ies).
	||
	|| current-status:	Current document status (ie., category)
	||
	|| publication-status:	Document status at time of publication.
	||
	|| see-also:	References to other related documents - intended as
	||		helpful information to the reader.
	||
    -->

    <xsd:element name="rfc-entry">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="doc-id" type="documentId"/>
		<xsd:element name="title" type="xsd:string"/>
		<xsd:element ref="author" maxOccurs="unbounded"/>
		<xsd:element ref="date"/>
		<xsd:element ref="format" minOccurs="0" maxOccurs="3"/>
		<xsd:element ref="keywords" minOccurs="0"/>
		<xsd:element name="abstract" type="xsd:string" minOccurs="0"/>
		<xsd:element name="draft" type="xsd:string" minOccurs="0"/>
		<xsd:element name="notes" type="xsd:string" minOccurs="0"/>
		<xsd:element name="obsoletes" type="documentRef" minOccurs="0"/>
		<xsd:element name="obsoleted-by" type="documentRef" minOccurs="0"/>
		<xsd:element name="updates" type="documentRef" minOccurs="0"/>
		<xsd:element name="updated-by" type="documentRef" minOccurs="0"/>
		<xsd:element name="is-also" type="documentRef" minOccurs="0"/>
		<xsd:element name="see-also" type="documentRef" minOccurs="0"/>
		<xsd:element name="current-status" type="status"/>
		<xsd:element name="publication-status" type="status"/>
		<xsd:element name="errata-url" type="xsd:string" minOccurs="0"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!--
	|| Notes on Not Issued RFC Entries:
	||
	|| Certain RFC numbers were retained as place holders, but never
	|| issued.  This distinction is made through the use of a
	|| rfc-not-issued-entry.  Since the document described by this entry
	|| has no properties (and in fact does not exist), we only include
	|| its reserved RFC number.  This is found in the <doc-id> tag.
	||
    -->

    <!-- structure for unpublished RFCs (placeholders) -->
    <xsd:element name="rfc-not-issued-entry">
	<xsd:complexType>
	    <xsd:sequence>
		<xsd:element name="doc-id" type="documentId"/>
	    </xsd:sequence>
	</xsd:complexType>
    </xsd:element>

    <!--
	|| Notes on the RFC Index root element:
	||
	|| Each valid XML instance will contain exactly one <rfc-index>
	|| element.  It will serve as a container for all of the underlying
	|| document entries.  It has one optional attribute named 'title'
	|| that can be used to name the particular index instance.
	||
	|| <rfc-index> possesses a rather loose structure that allows
	|| any number of document entries (std-entry, bcp-entry, fyi-entry,
	|| rfc-entry, rfc-not-issued-entry) to appear in any order.  This is
	|| to facilitate ordering based upon <doc-id>.
	||
    -->

    <xsd:element name="rfc-index">
	<xsd:complexType>
	    <xsd:sequence maxOccurs="unbounded">
		<xsd:element ref="std-entry" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element ref="bcp-entry" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element ref="fyi-entry" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element ref="rfc-entry" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element ref="rfc-not-issued-entry" minOccurs="0" maxOccurs="unbounded"/>
	    </xsd:sequence>
	    <xsd:attribute name="title" type="xsd:string" use="optional"/>
	</xsd:complexType>
    </xsd:element>

</xsd:schema>
