<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="https://oid-base.com"
            xmlns="https://oid-base.com"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xhtml="https://oid-base.com/xhtml-light.xsd">

  <xsd:import namespace="https://oid-base.com/xhtml-light.xsd"
              schemaLocation="https://oid-base.com/xhtml-light.xsd"/>

  <xsd:element name="oid-database">
    <xsd:annotation>
      <xsd:documentation>
	This schema contains the XML format needed to create and describe
	one or more object identifiers (OIDs) in the OID repository
        located at https://oid-base.com.
	N.B.: Each file can only contain one top-level <oid-database/> tag.
	To submit your XML file, go to https://oid-base.com/submit.htm
	Example of an "oid-database" XML file:

	<!--
	<oid-database>
		<submitter>
			<first-name>John</first-name>
			<last-name>Smith</last-name>
			<email>john.smith@myhost.com</email>
		</submitter>
	
		<oid>
			<value>{joint-iso-itu-t(2) example(999) xml-submission(777)}</value>
			<synonymous-identifier>oid-repository</synonymous-identifier>
			<description>Example of a description conforming to the
                           <a href="https://oid-base.com/oid.xsd">XML Schema of
                           the OID Repository</a>.</description>
			<information>More information can be found at
                           <a href="https://oid-base.com/submit.htm">Submit OID
                           descriptions as XML files</a>.</information>
			<current-registrant>
				<first-name>John</first-name>
				<last-name>Doe</last-name>
				<email>john.doe@dummy.com</email>
				<modification-date>2002-05-25</modification-date>
			</current-registrant>
			<first-registrant>
				<first-name>Paul</first-name>
				<last-name>Connor</last-name>
				<email>paul.connor@myhost.com</email>
				<creation-date>1999-12-31</creation-date>
			</first-registrant>
		</oid>
	</oid-database>
	-->

      </xsd:documentation>
    </xsd:annotation>

    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="submitter" type="Submitter">
	  <xsd:annotation>
	    <xsd:documentation>
		The submitter is the person (probably you!) who creates the XML document
		conforming to this XML schema.
	    </xsd:documentation>
	  </xsd:annotation>
	</xsd:element>
	
        <xsd:element name="oid" type="Oid" minOccurs="1" maxOccurs="unbounded">
	  <xsd:annotation>
	    <xsd:documentation>
		Fill one <oid/> element per OID to be added in the database.
	    </xsd:documentation>
	  </xsd:annotation>
	</xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

	 
<!-- Here begins the description of an object identifier (OID). -->
  <xsd:complexType name="Oid">
    <xsd:sequence>
      <xsd:element name="value">
        <xsd:annotation>
          <xsd:documentation>
            This is the value (path) of the OID either in ASN.1 notation
            (with or without curly brackets) or in dot notation.
          </xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="\{?\s*(((([a-z][a-zA-Z0-9\-]*\s*((\s*(0|[1-9][0-9]*)\s*\))?|(0|[1-9][0-9]*))){2,}\s*)|((0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*))\s*\}?"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>

      <xsd:element name="synonymous-identifier" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation>
	      The <synonymous-identifier/> element is used to associate
	      other identifiers (words beginning with a lowercase letter)
	      to the last arc of the OID being defined.
	      For example "ccitt" is a synonymous id for "itu-t".
	      It is recommended to use this element when the dot-notation is
              used to identify the OID in tag <value/>, because in that case
              no identifier is associated with the last arc.
	      Note that you should not use this element to add the same
	      identifier as the one already associated with the last arc when
	      the ASN.1 notation is used to identify the OID in tag <value/>.
              If present, the identifier associated with the last arc in
              tag <value/> is retained as the main identifier to designate the
              arc being defined. Otherwise the first <synonymous-identifier/>
              is used.
            </xsd:documentation>
          </xsd:annotation>
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="[a-z][a-zA-Z0-9\-]*"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>

      <xsd:element name="description" type="xhtml:xhtml-light">  
        <xsd:annotation>
          <xsd:documentation>
            The <description/> element usually contains a short piece of
	    text which describes the purpose of the OID. A subset of XHTML
	    (in particular, <a href="..."/> in lowercase letters) can be used.
	    Note that non ASCII characters should be coded in a form such as
	    &#233; (instead of a latin small letter e with acute). Note also
	    that newline characters will be replaced by the HTML tag <br/>
            except if you select the -ignoreNL option at
            https://oid-base.com/submit.htm when
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="information" type="xhtml:xhtml-light" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
	    The <information/> element gives more information about the
	    OID. URLs, references to documents and standards, and rules on how
	    to create subarcs are expected. A subset of XHTML (in particular,
            <a href="..."/> in lowercase letters) can be used.
	    Note that non ASCII characters should be coded in a form such as
	    &#233; (instead of a letter e with acute accent). Note also that
	    newline characters will be replaced by the HTML tag <br/> except
            if you select the -ignoreNL option at https://oid-base.com/submit.htm
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="current-registrant" minOccurs="0" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
	      The <current-registrant/> element is used to indicate the
              person or company (different from the first RA) who is
              currently in charge of the OID, allocating subarcs and 
              registering information on these subarcs (see
              https://oid-base.com/faq.htm#registration-authorities). If the
              current RA is known, it is recommended to fill this element
              because the identified contact will be automatically notified by
              email each time someone creates a child OID, or submits
              modifications on the current OID or on any child OID. If this
              OID was recently allocated, the current RA is probably still the
              first RA, so please fill the boxes in the <first-registrant/>
              element below.
            </xsd:documentation>
          </xsd:annotation>
        <xsd:complexType>
          <xsd:complexContent>
            <xsd:extension base="Registrant">
              <xsd:sequence>
                <xsd:element name="modification-date" minOccurs="0" maxOccurs="1">
           	  <xsd:annotation>
            	    <xsd:documentation>
			The <modification-date/> element is used to describe
			when the current-registrant was nominated (if known).
	                The date format is CCYY-MM-DD or CCYY/MM/DD or CCYY-MM or
                                           CCYY/MM or CCYY.
        	    </xsd:documentation>
	          </xsd:annotation>
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                       <xsd:pattern value="[0-9]{4}([/-](0?[1-9]|1[1-2])([-/](0?[1-9]|[1-2][0-9]|3[0-1]))?)?"/>
                    </xsd:restriction>
                  </xsd:simpleType>
		</xsd:element>
              </xsd:sequence>
            </xsd:extension>
          </xsd:complexContent>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="first-registrant" minOccurs="0" maxOccurs="1">
	<xsd:annotation>
   	  <xsd:documentation>
		The <first-registrant/> element is used to indicate the very
	    	first person (if known) responsible for managing this OID
                (see https://oid-base.com/faq.htm#registration-authorities).
                If the first RA is known, it is recommended to fill this
                element because the identified contact will be automatically
                notified by email each time someone creates a child OID, or
                submits modifications on the current OID or on any child OID.
                When the responsabilities are transfered to someone else, the
                <current-registrant/> element above is filled and the data in
                this element are kept for historic purposes.
	  </xsd:documentation>
	</xsd:annotation>
        <xsd:complexType>
          <xsd:complexContent>
            <xsd:extension base="Registrant">
              <xsd:sequence>
                <xsd:element name="creation-date" type="xsd:date" minOccurs="0" maxOccurs="1">
		  <xsd:annotation>
            	    <xsd:documentation>
			The <creation-date/> element is used to describe when
			the OID was first registered (if known). It is not the
			date when the OID description is submitted to the OID
			repository.
	                The date format is CCYY-MM-DD or CCYY/MM/DD or CCYY-MM or
                                           CCYY/MM or CCYY.
        	    </xsd:documentation>
	          </xsd:annotation>
		</xsd:element>
              </xsd:sequence>
            </xsd:extension>
          </xsd:complexContent>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>


  <xsd:complexType name="Submitter">
    <xsd:sequence>
      <xsd:element name="first-name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="last-name" type="xsd:string"/>
      <xsd:element name="email" type="Email">
        <xsd:annotation>
          <xsd:documentation>
		This email address is for internal use, to keep you informed 
    		that the submission went smoothly. It will not be displayed
		on the web.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>



  <xsd:complexType name="Registrant">
    <xsd:sequence>
        <xsd:annotation>
          <xsd:documentation>
		 At least one of the following elements is required.
          </xsd:documentation>
        </xsd:annotation>
      <xsd:element name="first-name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="last-name" type="xsd:string" minOccurs="0"
      maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
	     If the registrant is a company or an organization, use the
             <last-name/> element to give its name.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="email" type="Email" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
	     An antispam modifier will be applied to this email address
	     when displayed on the web.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="address" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="phone" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="fax" type="xsd:string" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
  
  <xsd:simpleType name="Email">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z0-9_\-\.]+@(\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.|([a-zA-Z0-9\-]+\.))+([a-zA-Z]{2,4}|[0-9]{1,3})\]?"/>
    </xsd:restriction>
  </xsd:simpleType>  
</xsd:schema>
