wiki/assets/opensearch/opensearch.xsd

579 lines
24 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
OpenSearch 1.1 Draft 6 XML Schema
Copyright (c) 2021 ~lucidiot
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file was derived from the OpenSearch 1.1 Draft 6 specification at
<https://github.com/dewitt/opensearch/blob/8446769af24e313f308beeb590173c1aca57de9f/opensearch-1-1-draft-6.md>
-->
<xs:schema
targetNamespace="http://a9.com/-/spec/opensearch/1.1/"
elementFormDefault="qualified"
xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:geo="http://a9.com/-/opensearch/extensions/geo/1.0/"
xmlns:parameters="http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"
xmlns:referrer="http://a9.com/-/opensearch/extensions/referrer/1.0/"
xmlns:suggestions="http://www.opensearch.org/specifications/opensearch/extensions/suggestions/1.1/"
xmlns:time="http://a9.com/-/opensearch/extensions/time/1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:import
namespace="http://a9.com/-/opensearch/extensions/geo/1.0/"
schemaLocation="geo.xsd"
/>
<xs:import
namespace="http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"
schemaLocation="parameters.xsd"
/>
<xs:import
namespace="http://a9.com/-/opensearch/extensions/referrer/1.0/"
schemaLocation="referrer.xsd"
/>
<xs:import
namespace="http://www.opensearch.org/specifications/opensearch/extensions/suggestions/1.1/"
schemaLocation="suggestions.xsd"
/>
<xs:import
namespace="http://a9.com/-/opensearch/extensions/time/1.0/"
schemaLocation="time.xsd"
/>
<xs:simpleType name="ShortName">
<xs:annotation>
<xs:documentation>
Contains a brief human-readable title that identifies this search engine.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="16" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Description">
<xs:annotation>
<xs:documentation>
Contains a human-readable text description of the search engine.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="1024" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UrlRelToken">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="results">
<xs:annotation>
<xs:documentation>
Represents a request for search results in the specified format.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="suggestions">
<xs:annotation>
<xs:documentation>
Represents a request for search suggestions in the specified format.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="self">
<xs:annotation>
<xs:documentation>
Represents the canonical URL of this description document.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="collection">
<xs:annotation>
<xs:documentation>
Represents a request for a set of resources.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:anyURI">
<xs:pattern value="#[a-z][a-z-]+$" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="UrlRel">
<xs:annotation>
<xs:documentation>
Rel attribute strings can contain a space-delimited list of one or more semantically meaningful
rel value tokens. An empty rel attribute value should be treated by the client as if the rel
attribute was not present at all.
If a client does not recognize the semantic meaning of any rel value token, then the containing
Url should be ignored by the client.
</xs:documentation>
</xs:annotation>
<xs:list itemType="UrlRelToken" />
</xs:simpleType>
<xs:complexType name="Url">
<xs:annotation>
<xs:documentation>
Describes an interface by which a client can make requests for an external resource,
such as search results, search suggestions, or additional description documents.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Parameter" type="parameters:Parameter" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="template" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
The URL template to be processed according to the OpenSearch URL template syntax.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
The MIME type of the resource being described.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="rel" type="UrlRel" default="results">
<xs:annotation>
<xs:documentation>
The role of the resource being described in relation to the description document.
Contains a space-delimited list of valid rel value tokens.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="indexOffset" type="xs:integer" default="1">
<xs:annotation>
<xs:documentation>
The index number of the first search result.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="pageOffset" type="xs:integer" default="1">
<xs:annotation>
<xs:documentation>
The page number of the first set of search results.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="parameters:UrlAttributes" />
</xs:complexType>
<xs:simpleType name="Contact">
<xs:annotation>
<xs:documentation>
Contains an email address at which the maintainer of the description document can be reached.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Tags">
<xs:annotation>
<xs:documentation>
Contains a set of words that are used as keywords to identify and categorize this search content. Tags must be a single word and are delimited by the space character.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="256" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LongName">
<xs:annotation>
<xs:documentation>
Contains an extended human-readable title that identifies this search engine.
Search clients should use the value of the ShortName element if this element is not available.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="48" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Image">
<xs:annotation>
<xs:documentation>
Contains a URL that identifies the location of an image that can be used in association with this search content.
Image sizes are offered as a hint to the search client.
The search client will choose the most appropriate image for the available space and should give preference
to those listed first in the OpenSearch description document. Square aspect ratios are recommended.
When possible, search engines should offer a 16x16 image of type "image/x-icon" or "image/vnd.microsoft.icon"
(the Microsoft ICO format) and a 64x64 image of type "image/jpeg" or "image/png".
</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="height" type="xs:positiveInteger" use="optional">
<xs:annotation>
<xs:documentation>
Contains the height, in pixels, of this image.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="width" type="xs:positiveInteger" use="optional">
<xs:annotation>
<xs:documentation>
Contains the width, in pixels, of this image.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Contains the the MIME type of this image.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="QueryRole">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="request">
<xs:annotation>
<xs:documentation>
Represents the search query that can be performed to retrieve the same set of search results.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="example">
<xs:annotation>
<xs:documentation>
Represents a search query that can be performed to demonstrate the search engine.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="related">
<xs:annotation>
<xs:documentation>
Represents a search query that can be performed to retrieve similar but different search results.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="correction">
<xs:annotation>
<xs:documentation>
Represents a search query that can be performed to improve the result set, such as with a spelling correction.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="subset">
<xs:annotation>
<xs:documentation>
Represents a search query that will narrow the current set of search results.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="superset">
<xs:annotation>
<xs:documentation>
Represents a search query that will broaden the current set of search results.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:Name">
<xs:pattern value=":" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="QueryTitle">
<xs:restriction base="xs:string">
<xs:maxLength value="256" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Query">
<xs:annotation>
<xs:documentation>
Defines a search query that can be performed by search clients.
OpenSearch description documents should include at least one Query element of role="example"
that is expected to return search results. Search clients may use this example query to
validate that the search engine is working properly.
Search engines should include a Query element of role="request" in each search response
so that search clients can recreate the current search.
</xs:documentation>
</xs:annotation>
<xs:attribute name="role" type="QueryRole" use="required">
<xs:annotation>
<xs:documentation>
Contains a string identifying how the search client should interpret
the search request defined by this Query element.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="title" type="QueryTitle" use="optional">
<xs:annotation>
<xs:documentation>
Contains a human-readable plain text string describing the search request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="totalResults" type="xs:nonNegativeInteger" use="optional">
<xs:annotation>
<xs:documentation>
Contains the expected number of results to be found if the search request were made.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="searchTerms" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the searchTerms as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="count" type="xs:nonNegativeInteger" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the count as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="startIndex" type="xs:integer" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the startIndex as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="startPage" type="xs:integer" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the startPage as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="language" type="Language" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the language as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="inputEncoding" type="InputEncoding" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the inputEncoding as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="outputEncoding" type="OutputEncoding" use="optional">
<xs:annotation>
<xs:documentation>
Contains the value representing the outputEncoding as an OpenSearch 1.1 parameter name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="geo:QueryAttributes" />
<xs:attributeGroup ref="referrer:QueryAttributes" />
<xs:attributeGroup ref="suggestions:QueryAttributes" />
<xs:attributeGroup ref="time:QueryAttributes" />
</xs:complexType>
<xs:simpleType name="Developer">
<xs:annotation>
<xs:documentation>
Contains the human-readable name or identifier of the creator or maintainer of the description document.
The developer is the person or entity that created the description document,
and may or may not be the owner, author, or copyright holder of the source of the content itself.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="64" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Attribution">
<xs:annotation>
<xs:documentation>
Contains a list of all sources or entities that should be credited for the content contained in the search feed.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="256" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SyndicationRight">
<xs:annotation>
<xs:documentation>
Contains a value that indicates the degree to which the search results provided by this search engine
can be queried, displayed, and redistributed.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="open">
<xs:annotation>
<xs:documentation>
The search client may request search results.
The search client may display the search results to end users.
The search client may send the search results to other search clients.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="limited">
<xs:annotation>
<xs:documentation>
The search client may request search results.
The search client may display the search results to end users.
The search client may not send the search results to other search clients.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="private">
<xs:annotation>
<xs:documentation>
The search client may request search results.
The search client may not display the search results to end users.
The search client may not send the search results to other search clients.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="closed">
<xs:annotation>
<xs:documentation>
The search client may not request search results.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AdultContent">
<xs:annotation>
<xs:documentation>
Contains a boolean value that should be set to true if the search results may contain material intended only for adults.
As there are no universally applicable guidelines as to what constitutes "adult" content,
the search engine should make a good faith effort to indicate when there is a possibility
that search results may contain material inappropriate for all audiences.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:annotation>
<xs:documentation>
The values "false", "FALSE", "0", "no", and "NO" will be considered boolean FALSE;
all other strings will be considered boolean TRUE.
</xs:documentation>
</xs:annotation>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Language">
<xs:annotation>
<xs:documentation>
Contains a string that indicates that the search engine supports search results in the specified language.
An OpenSearch description document should include one Language element for each language that the search engine supports.
If the search engine also supports queries for any arbitrary language then the OpenSearch description document
should include a Language element with a value of "*".
The "language" template parameter in the OpenSearch URL template can be used to allow the search client
to choose among the available languages.
</xs:documentation>
</xs:annotation>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:language" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="*">
<xs:annotation>
<xs:documentation>
The value of "*" signifies that the search engine does not restrict search results to any particular language.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="InputEncoding">
<xs:annotation>
<xs:documentation>
Contains a string that indicates that the search engine supports search requests encoded with
the specified character encoding.
An OpenSearch description document should include one InputEncoding element for each character encoding
that can be used to encode search requests. The "inputEncoding" template parameter in the OpenSearch URL
template can be used to require the search client to identify which encoding is being used to encode
the current search request.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:simpleType name="OutputEncoding">
<xs:annotation>
<xs:documentation>
Contains a string that indicates that the search engine supports search responses encoded with
the specified character encoding.
An OpenSearch description document should include one OutputEncoding element for each character encoding
that can be used to encode search responses. The "outputEncoding" template parameter in the OpenSearch URL
template can be used to allow the search client to choose a character encoding in the search response.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:complexType name="OpenSearchDescription">
<xs:annotation>
<xs:documentation>
The root node of the OpenSearch description document.
</xs:documentation>
</xs:annotation>
<!--
This is XSD 1.0; it is not possible to have a maxOccurs="unbounded" within xs:all,
so I use xs:choice instead but it means that any of the min/maxOccurs defined for
each xs:element will not be actually validated. They are just left here for
documentation purposes. XSD 1.1 would fix this situation, but is implemented by
almost nobody. It would be technically possible to use 8! xs:sequence elements
(8 being the amount of elements that are either present at least or no more than once),
but that would probably overload many validators.
-->
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ShortName" type="ShortName" minOccurs="1" maxOccurs="1" />
<xs:element name="Description" type="Description" minOccurs="1" maxOccurs="1" />
<xs:element name="Contact" type="Contact" minOccurs="0" maxOccurs="1" />
<xs:element name="Url" type="Url" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="LongName" type="LongName" minOccurs="0" maxOccurs="1" />
<xs:element name="Image" type="Image" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Query" type="Query" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Developer" type="Developer" minOccurs="0" maxOccurs="1" />
<xs:element name="SyndicationRight" type="SyndicationRight" minOccurs="0" maxOccurs="1" default="open" />
<xs:element name="AdultContent" type="AdultContent" minOccurs="0" maxOccurs="1" />
<xs:element name="Language" type="Language" minOccurs="0" maxOccurs="unbounded" default="*" />
<xs:element name="InputEncoding" type="InputEncoding" minOccurs="0" maxOccurs="unbounded" default="UTF-8" />
<xs:element name="OutputEncoding" type="OutputEncoding" minOccurs="0" maxOccurs="unbounded" default="UTF-8" />
</xs:choice>
</xs:complexType>
<xs:element name="OpenSearchDescription" type="OpenSearchDescription" />
</xs:schema>