itsb/itsb.xsd

357 lines
20 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tilde.town/~lucidiot/itsb/itsb.xsd" version="1.0" elementFormDefault="qualified" xmlns="http://tilde.town/~lucidiot/itsb/itsb.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="itsbURL">
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="verify-ssl" type="xs:boolean" use="optional" default="true">
<xs:annotation>
<xs:documentation>
Whether or not an automated script should verify or ignore the validity
of the SSL certificate for an HTTPS URL.
This is commonly required due to poor website management.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="itsb">
<xs:annotation>
<xs:documentation>
This schema describes both the structure for the directory page of ITSB
and the list of syndication feeds either inventoried or generated by ITSB.
This is meant to be used as a central place to hold feed configuration and
reduce duplication.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="section" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
A separate section displayed in an HTML directory.
Should be ignored by machines.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="content" minOccurs="0" maxOccurs="unbounded" type="xs:string">
<xs:annotation>
<xs:documentation>
Raw, encoded HTML content that should be displayed as-is in the section.
Can be ignored by machines.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="source" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
A single source of investigation reports that can provide one or more syndication feeds.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Source name for display purposes.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="description" minOccurs="0" type="xs:string">
<xs:annotation>
<xs:documentation>
Optional description of the source. Encoded HTML tags are allowed.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="region" minOccurs="0" type="xs:string">
<xs:annotation>
<xs:documentation>
Optional country or region in which the source acts.
If the region is not a country, it should be suffixed with a comma, then a country: "Austin, Texas"
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="type" minOccurs="0" type="xs:string">
<xs:annotation>
<xs:documentation>
Report types, generally the means of transportation, that the source produces.
This should be a comma-separated list of types and is only meant for display purposes.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="frequency" minOccurs="0" type="xs:string">
<xs:annotation>
<xs:documentation>
Arbitrary human estimation of the frequency of report publication for this source.
Generally expressed in reports per year, sometimes with different values for different languages.
Only for display purposes.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="license" minOccurs="0">
<xs:annotation>
<xs:documentation>
A particular license that the source applies on its reports.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="url" type="xs:anyURI" use="optional">
<xs:annotation>
<xs:documentation>
URL pointing to an HTML page for a description of the license.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="feed" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
<![CDATA[
A single syndication feed for this source.
Can be either generated by ITSB or provided externally.
When provided externally, only the <link> tag can be used.
]]>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="curl">
<xs:complexType>
<xs:sequence>
<xs:element name="url" type="itsbURL">
<xs:annotation>
<xs:documentation>
URL of the original HTML webpage that will be retrieved to be converted into a feed.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="header" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
HTTP headers sent along with the request.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<!-- TODO: Make HTTP header names unique per request -->
<xs:attribute name="name" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="requestBody" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>
Optional request body sent along with the request. When this element is used, the request becomes a POST request.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pup">
<xs:annotation>
<xs:documentation>
CSS 3 selector that will be applied using pup on the HTML webpage. The JSON output mode will be applied automatically.
If omitted, the JSON output is not applied and the downloaded content is sent directly to the script without any preprocessing.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="output" use="optional" default="json">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="json">
<xs:annotation>
<xs:documentation>Output the selected tags as JSON (default).</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="text">
<xs:annotation>
<xs:documentation>Output the selected tags' inner text.</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="html">
<xs:annotation>
<xs:documentation>Output the selected tags as HTML.</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="xml2json">
<xs:annotation>
<xs:documentation>
Run XML to JSON conversion using xmltodict.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="json2xml">
<xs:annotation>
<xs:documentation>
Run JSON to XML conversion using xmltodict.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="namespace" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
Add an XML namespace abbreviation to be recognized by xmltodict.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<!-- TODO: Make namespace prefixes unique in each call to json2xml -->
<xs:attribute name="prefix" type="xs:string" use="optional" default="">
<xs:annotation>
<xs:documentation>
The namespace prefix to use in the XML output. When not defined, this will become the default prefix (xmlns).
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="short-empty" type="xs:boolean" use="optional" default="false">
<xs:annotation>
<xs:documentation><![CDATA[Shorten empty elements to <tag/> instead of <tag></tag>.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="jq">
<xs:complexType>
<xs:sequence>
<xs:element name="arg" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
Arguments that will be passed to the jq script using jq's --arg parameter.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<!-- TODO: Make argument names unique per call -->
<xs:attribute name="name" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="path" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
Path to the jq script relative to the project's jq/ directory.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="raw-output" type="xs:boolean" default="false">
<xs:annotation>
<xs:documentation>
Enable the -r flag, causing jq to output raw strings instead of JSON strings.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="shell">
<xs:annotation>
<xs:documentation>
A shell command. No escaping and no controls will be made on this command, especially on spaces and newlines; use this tag with care.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:element name="output" type="xs:string">
<!-- TODO: Make output files unique globally -->
<xs:annotation>
<xs:documentation>
Path to the resulting feed, relative to the /feeds/ directory.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:element name="link" type="itsbURL">
<xs:annotation>
<xs:documentation>
URL to an external syndication feed.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<!-- TODO: Make lang/type/format combinations unique per source -->
<xs:attribute name="lang" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
Language of the reports in this feed. Not a language code; only for display purposes.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Report types, similar to the type tag on sources, for this particular feed.
Allows adding multiple feeds filtered by types.
When this type is omitted, the source's type can be assumed.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="format" default="rss">
<xs:annotation>
<xs:documentation>
Format of the syndication feed.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="atom" />
<xs:enumeration value="cdf" />
<xs:enumeration value="echo" />
<xs:enumeration value="json" />
<xs:enumeration value="rdf" />
<xs:enumeration value="rss" />
<xs:enumeration value="rss3" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:ID" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Title of the section.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="id" type="xs:ID" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="version" use="required" fixed="1.0" />
</xs:complexType>
</xs:element>
</xs:schema>