Skip to main content

Version 1.0 (Draft)

Source on GitHub

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MetronInfo" type="metroninfoType" />

<!-- Complex Types -->
<xs:complexType name="metroninfoType">
<xs:all>
<xs:element name="IDS" type="idsType" minOccurs="0" />
<xs:element name="Publisher" type="publisherType" minOccurs="0" />
<xs:element name="Series" type="seriesType" />
<xs:element name="MangaVolume" type="xs:string" minOccurs="0" /> <!-- This is used for Manga -->
<xs:element name="CollectionTitle" type="xs:string" minOccurs="0" />
<xs:element name="Number" type="xs:string" minOccurs="0" />
<xs:element name="Stories" type="storyType" minOccurs="0" /> <!-- Story titles in issue -->
<xs:element name="Summary" type="xs:string" minOccurs="0" />
<xs:element name="Prices" type="pricesType" minOccurs="0" />
<xs:element name="CoverDate" type="xs:date" minOccurs="0" />
<xs:element name="StoreDate" type="xs:date" minOccurs="0" />
<xs:element name="PageCount" type="xs:nonNegativeInteger" minOccurs="0" default="0" />
<xs:element name="Notes" type="xs:string" minOccurs="0" />
<xs:element name="Genres" type="genresType" minOccurs="0" />
<xs:element name="Tags" type="tagsType" minOccurs="0" />
<xs:element name="Arcs" type="arcsType" minOccurs="0" />
<xs:element name="Characters" type="charactersType" minOccurs="0" />
<xs:element name="Teams" type="teamsType" minOccurs="0" />
<xs:element name="Universes" type="universesType" minOccurs="0" />
<xs:element name="Locations" type="locationsType" minOccurs="0" />
<xs:element name="Reprints" type="reprintsType" minOccurs="0" />
<xs:element name="GTIN" type="gtinType" minOccurs="0" />
<xs:element name="AgeRating" type="ageRatingType" minOccurs="0" default="Unknown" />
<xs:element name="URLs" type="urlsType" minOccurs="0" />
<xs:element name="Credits" type="creditsType" minOccurs="0" />
<xs:element name="LastModified" type="xs:dateTime" minOccurs="0" />
</xs:all>
</xs:complexType>

<xs:complexType name="urlsType">
<xs:sequence>
<xs:element name="URL" type="urlType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:assert test="count(URL[@primary = true()]) &lt;= 1" />
</xs:complexType>

<xs:complexType name="urlType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="primary" type="xs:boolean" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="idsType">
<xs:sequence>
<xs:element name="ID" type="idType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:assert test="count(ID[@primary = true()]) &lt;= 1" />
</xs:complexType>

<xs:complexType name="idType">
<xs:simpleContent>
<xs:extension base="xs:positiveInteger">
<xs:attribute name="source" type="informationSource" use="required" />
<xs:attribute name="primary" type="xs:boolean" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="storyType">
<xs:sequence>
<xs:element name="Story" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<!-- Base type to add 'id' attribute to the various resources -->
<xs:complexType name="resourceType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="publisherType">
<xs:all>
<xs:element name="Name" type="xs:string" />
<xs:element name="Imprint" type="resourceType" minOccurs="0" />
</xs:all>
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:complexType>

<xs:complexType name="seriesType">
<xs:all>
<xs:element name="Name" type="xs:string" />
<xs:element name="SortName" type="xs:string" minOccurs="0" />
<xs:element name="Volume" type="xs:nonNegativeInteger" minOccurs="0" />
<xs:element name="Format" type="formatType" minOccurs="0" />
<xs:element name="StartYear" type="xs:gYear" minOccurs="0" />
<xs:element name="IssueCount" type="xs:positiveInteger" minOccurs="0" />
<xs:element name="VolumeCount" type="xs:positiveInteger" minOccurs="0" />
<xs:element name="AlternativeNames" type="alternativeNameType" minOccurs="0" />
</xs:all>
<xs:attribute name="lang" type="languageCode" default="en" />
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:complexType>

<xs:complexType name="alternativeNameType">
<xs:sequence>
<xs:element name="AlternativeName" type="nameType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<!-- Alternative Series Name Base type -->
<xs:complexType name="nameType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:positiveInteger" />
<xs:attribute name="lang" type="languageCode" default="en" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="charactersType">
<xs:sequence>
<xs:element name="Character" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="teamsType">
<xs:sequence>
<xs:element name="Team" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="locationsType">
<xs:sequence>
<xs:element name="Location" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="tagsType">
<xs:sequence>
<xs:element name="Tag" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="reprintsType">
<xs:sequence>
<xs:element name="Reprint" type="resourceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="universesType">
<xs:sequence>
<xs:element name="Universe" type="universeType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="universeType">
<xs:all>
<xs:element name="Name" type="xs:string" />
<xs:element name="Designation" type="xs:string" minOccurs="0" />
</xs:all>
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:complexType>

<xs:complexType name="arcsType">
<xs:sequence>
<xs:element name="Arc" type="arcType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="arcType">
<xs:all>
<xs:element name="Name" type="xs:string" />
<xs:element name="Number" type="xs:positiveInteger" minOccurs="0" />
</xs:all>
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:complexType>

<xs:complexType name="creditsType">
<xs:sequence>
<xs:element name="Credit" type="creditType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="roleType">
<xs:simpleContent>
<xs:extension base="roleValues">
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="rolesType">
<xs:sequence>
<xs:element name="Role" type="roleType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="creditType">
<xs:all>
<xs:element name="Creator" type="resourceType" />
<xs:element name="Roles" type="rolesType" minOccurs="0" />
</xs:all>
</xs:complexType>

<xs:complexType name="genreType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:positiveInteger" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="genresType">
<xs:sequence>
<xs:element name="Genre" type="genreType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="pricesType">
<xs:sequence>
<xs:element name="Price" type="priceType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="priceType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="country" type="countryCode" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="gtinType">
<xs:all>
<xs:element name="ISBN" minOccurs="0" />
<xs:element name="UPC" minOccurs="0" />
</xs:all>
</xs:complexType>

<!-- Simple Types -->
<xs:simpleType name="formatType">
<xs:restriction base="xs:string">
<xs:enumeration value="Annual" />
<xs:enumeration value="Digital Chapter" />
<xs:enumeration value="Graphic Novel" />
<xs:enumeration value="Hardcover" />
<xs:enumeration value="Limited Series" /> <!-- Used for mini/maxi series -->
<xs:enumeration value="Omnibus" />
<xs:enumeration value="One-Shot" />
<xs:enumeration value="Single Issue" /> <!-- Used for Ongoing/Cancelled series -->
<xs:enumeration value="Trade Paperback" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="informationSource">
<xs:restriction base="xs:string">
<xs:enumeration value="AniList" />
<xs:enumeration value="Comic Vine" />
<xs:enumeration value="Grand Comics Database" />
<xs:enumeration value="Marvel" />
<xs:enumeration value="Metron" />
<xs:enumeration value="MyAnimeList" />
<xs:enumeration value="League of Comic Geeks" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="roleValues">
<xs:restriction base="xs:string">
<xs:enumeration value="Writer" />
<xs:enumeration value="Script" />
<xs:enumeration value="Story" />
<xs:enumeration value="Plot" />
<xs:enumeration value="Interviewer" />
<xs:enumeration value="Artist" />
<xs:enumeration value="Penciller" />
<xs:enumeration value="Breakdowns" />
<xs:enumeration value="Illustrator" />
<xs:enumeration value="Layouts" />
<xs:enumeration value="Inker" />
<xs:enumeration value="Embellisher" />
<xs:enumeration value="Finishes" />
<xs:enumeration value="Ink Assists" />
<xs:enumeration value="Colorist" />
<xs:enumeration value="Color Separations" />
<xs:enumeration value="Color Assists" />
<xs:enumeration value="Color Flats" />
<xs:enumeration value="Digital Art Technician" />
<xs:enumeration value="Gray Tone" />
<xs:enumeration value="Letterer" />
<xs:enumeration value="Cover" />
<xs:enumeration value="Editor" />
<xs:enumeration value="Consulting Editor" />
<xs:enumeration value="Assistant Editor" />
<xs:enumeration value="Associate Editor" />
<xs:enumeration value="Group Editor" />
<xs:enumeration value="Senior Editor" />
<xs:enumeration value="Managing Editor" />
<xs:enumeration value="Collection Editor" />
<xs:enumeration value="Production" />
<xs:enumeration value="Designer" />
<xs:enumeration value="Logo Design" />
<xs:enumeration value="Translator" />
<xs:enumeration value="Supervising Editor" />
<xs:enumeration value="Executive Editor" />
<xs:enumeration value="Editor In Chief" />
<xs:enumeration value="President" />
<xs:enumeration value="Publisher" />
<xs:enumeration value="Chief Creative Officer" />
<xs:enumeration value="Executive Producer" />
<xs:enumeration value="Other" />
</xs:restriction>
</xs:simpleType>

<!--
There's no governing body for age ratings, so let's use something fairly simple to cover most cases.
It won't be perfect, but adding different values for all the different ways publishers use them seems
unnecessarily difficult. The age ranges are just suggestions.
-->
<xs:simpleType name="ageRatingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Unknown" />
<xs:enumeration value="Everyone" /> <!-- Appropriate for readers of all ages. -->
<xs:enumeration value="Teen" /> <!-- Appropriate for readers age 12 and older. -->
<xs:enumeration value="Teen Plus" /> <!-- Appropriate for readers age 15 and older. -->
<xs:enumeration value="Mature" /> <!-- Appropriate for readers age 17 and older. -->
<xs:enumeration value="Explicit" /> <!-- Contains Gore, Sexually Explicit material that would be more extreme than R rating -->
<xs:enumeration value="Adult" /> <!-- Likely pornographic in nature -->
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="countryCode">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z]" />
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="languageCode">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z][a-z]" />
</xs:restriction>
</xs:simpleType>
</xs:schema>