xml/schema/projects/rss2.0.xsd

52 lines
2.8 KiB
XML
Raw Permalink Normal View History

2021-07-06 13:56:34 -04:00
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="https://www.rssboard.org/rss-specification/"
xmlns="https://www.rssboard.org/rss-specification"
xmlns:rss="https://www.rssboard.org/rss-specification"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:include schemaLocation="../lib/types/net.xsd"/>
<xs:include schemaLocation="../lib/types/rss2.0.xsd"/>
<!--
CURRENT RSS VERSION: 2.0.8
It should be specified as an <rss> attribute as `version="2.0"`, though.
-->
<!-- ROOT -->
<xs:element name="rss">
<xs:complexType>
<xs:all>
<xs:element name="channel" minOccurs="1" maxOccurs="1">
<!--
This is my *opinion*. RSS 2.0 specification does not indicate if the elements should be in order or not.
I enforce it for easy conformance to spec and to remove any ambiguity.
I base the ordering on the sample 2.0 feed (https://www.rssboard.org/files/sample-rss-2.xml).
-->
<xs:sequence>
<xs:element name="title" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
<xs:element name="link" type="t_net_http_basic_uri" minOccurs="1" maxOccurs="1"/>
<xs:element name="description" type="xs:string" minOccurs="1" maxOccurs="1"/>
<!--
TODO: This has a pattern definition per:
https://www.rssboard.org/rss-language-codes
https://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
Maybe an enumeration at some point? But it's... thousands of possible combinations.
And allowances are made for non-official ones, too.
-->
<xs:element name="language" type="xs:normalizedString" minOccurs="0" maxOccurs="1" default="en-us"/>
<xs:element name="copyright" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
<xs:element name="managingEditor" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:element>
</xs:all>
<!--
There isn't really a well-defined type string in the RSS spec for what version's valid values ARE, as they specify the version.
"xs:token" should be safe/sane enough.
-->
<xs:attribute name="version" type="xs:token" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>