<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
  xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.1"
  xmlns:vm="http://www.ivoa.net/xml/VOMetadata/v0.1"
  xmlns:doc="http://www.ivoa.net/xml/DocRegExt/v1.0"
  version="1.0"
  targetNamespace="http://www.ivoa.net/xml/DocRegExt/v1"
  elementFormDefault="unqualified"
  attributeFormDefault="unqualified"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <xs:annotation>
  <xs:appinfo>
    <vm:schemaName>DocRegExt</vm:schemaName>
    <vm:schemaPrefix>xs</vm:schemaPrefix>
    <vm:targetPrefix>doc</vm:targetPrefix>
  </xs:appinfo>
  <xs:documentation>
  A description of a document/education-like resource.
  </xs:documentation>
  </xs:annotation>
  <xs:import namespace="http://www.ivoa.net/xml/VOResource/v1.0"
    schemaLocation="http://docs.g-vo.org/schemata/VOResource.xsd"/>
  <xs:import namespace="http://www.ivoa.net/xml/VODataService/v1.1"
    schemaLocation="http://docs.g-vo.org/schemata/VODataService.xsd"/>

  <xs:complexType name="Document">
    <xs:annotation>
      <xs:documentation>
      A natural-language document.
      </xs:documentation>
      <xs:documentation>
        Natural-language documents suitable for registration include
        worked-out use cases, tutorials, courses, or even material like
        reference cards, provided they cover Virtual Observatory techniques.

        We consider all translations of a document as one resource.
        Individual translations are defined as doc:DocFile-typed
        capabilities.
      </xs:documentation>
    </xs:annotation>

    <xs:complexContent>
      <xs:extension base="vs:CatalogResource"/>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Edition">
    <xs:annotation>
      <xs:documentation>
        An “edition” (typically: translation) of the document.
      </xs:documentation>
      <xs:documentation>
        Although for a while, multiple editions of the document in one language
        may be given (corresponding perhaps to two “major” versions), in
        general, only the latest version of the document per language should be
        present.

        At least one interface with
        role="rendered" must be present, typcially of type doc:StaticFile.
        The access URL of the interface
        points to a rendered version of the edition (preferably in PDF,
        but other formats like HTML or Python notebooks are acceptable, too).

        Editors are strongly encouraged to also provide an
        interface with role="source", the accessURL of which should point
        to an editable version of the document, a version controlled
        repository, or the like.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="vr:Capability">
        <xs:sequence>
          <xs:element name="languageCode" type="xs:token"
            minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
                The language this document is (mainly) written in,
                as an BCP 47 language code.
              </xs:documentation>
              <xs:documentation>
                The country codes must be given in all lowercase.  This
                results in strings like en, de, or, where regions
                might actually matter, es-es or es-mx.

                This language is also the language for locTitle,
                irrespective of that element's xml:lang setting.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="locTitle" type="xs:token"
            minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>
                The translated document's title in the language specified
                by the language sibling.
              </xs:documentation>
              <xs:documentation>
                It is recommended to set this element's xml:lang element
                to the same value as the language sibling.  The reason
                xml:lang is not used in the first place is that with an
                extra element, enforcing that the content language is
                given is more straightforward.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
       </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="StaticFile">
    <xs:annotation>
      <xs:documentation>
        An endpoint that returns a single, constant document.
      </xs:documentation>
      <xs:documentation>
        Data providers are encouraged to provide a media type for
        that document.  For archives containing multiple files, multiple media
        types can be given.  Endpoints requiring further interaction
        before the desired document is retrieved (e.g., landing pages
        or version control interfaces) should use the vr:WebBrowser type.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="vr:Interface">
        <xs:sequence>
          <xs:element name="resultType" type="xs:string"
          		minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>
                An RFC 6838 media type of the document returned, or of
                a component of the document for archives.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
