Compare commits

...

18 Commits

Author SHA1 Message Date
~lucidiot 8551705f43 Post about the MI5 terrorist threat level 2023-11-26 00:10:01 +01:00
~lucidiot 1ea09cb4c9 Add optional XSD validation with xmllint 2023-11-23 00:28:22 +01:00
~lucidiot 38d514edbd Use a temporary file to avoid breaking production files on error 2023-11-23 00:25:26 +01:00
~lucidiot 394451ffbc Fix broken OPML generators in subdirectories 2023-11-23 00:24:23 +01:00
~lucidiot c6c970ff05 Fix handling of subdirectories when running XQuery OPML generators 2023-11-22 23:56:13 +01:00
~lucidiot a109a6b810 Fix line endings and trailing whitespace 2023-11-22 23:38:33 +01:00
~lucidiot db9fa89ea4 Use all the schemas 2023-11-22 23:33:54 +01:00
~lucidiot 07773a40e0 Add Webfeeds XML schema 2023-11-22 23:33:44 +01:00
~lucidiot a8741718eb Add RSS1 Syndication module XML schema 2023-11-22 23:33:33 +01:00
~lucidiot 4c2fb07cd9 Add W3C Basic Geo Vocabulary XML schema 2023-11-22 23:29:55 +01:00
~lucidiot 2dac77856f Add Feed Access Control XML schema 2023-11-22 23:29:43 +01:00
~lucidiot cff96c6a62 Add blogChannel XML schema 2023-11-22 23:29:36 +01:00
~lucidiot 1c919880ba Fixes on ICBM and Service Status schemas 2023-11-22 23:29:23 +01:00
~lucidiot 9424b590ca Use a common function to build OPML structures 2023-11-20 10:47:15 +01:00
~lucidiot 755b4777c9 Add XML schema for OPML 2.0 2023-11-19 21:01:39 +01:00
~lucidiot e8c1b81751 Ignore non-standard languages in Wikimedia OPML generator 2023-11-19 20:26:08 +01:00
~lucidiot 89e1f93edf Skip duplicated sources in Alert-Hub.org OPML generator 2023-11-19 20:25:48 +01:00
~lucidiot d3d46ba4c1 Fix CAP feeds in EnviroFlash OPML generator 2023-11-19 19:42:09 +01:00
23 changed files with 1055 additions and 331 deletions

View File

@ -1,17 +1,30 @@
.PHONY: all validate
all: css/sprites.css $(patsubst xquery/opml/%.xqy,opml/%.opml,$(wildcard xquery/opml/*.xqy))
all: css/sprites.css $(patsubst xquery/opml/%.xqy,opml/%.opml,$(wildcard xquery/opml/*.xqy) $(wildcard xquery/opml/*/*.xqy))
XMLLINT_PATH:=$(shell command -v xmllint || true)
ifeq ($(XMLLINT_PATH),)
$(info xmllint is not available, all XSD validations will be skipped)
endif
USER_AGENT:="RSRSSS/1.0 (+https://envs.net/~lucidiot/rsrsss/feed.xml)"
export XIDEL_OPTIONS:=--silent --user-agent=$(USER_AGENT) --wait=1 --trace-stack
opml/%.opml: xquery/opml/%.xqy
opml/%.opml: xquery/opml/%.xqy xquery/functions.xqy
mkdir -p -ma=x,u=rwx $(dir $@)
xidel --extract-kind=xquery3 --extract-file="$<" --output-format=xml > $@
xidel --extract-kind=xquery3 --extract-file="$<" --output-format=xml > $@.new
ifneq ($(XMLLINT_PATH),)
$(XMLLINT_PATH) --schema xsd/opml.xsd --noout $@.new
endif
mv $@.new $@
chmod a=r,u=rw $@
opml/feeds.opml: xquery/opml/feeds.xqy feed.xml
mkdir -p -ma=x,u=rwx $(dir $@)
xidel feed.xml --extract-kind=xquery3 --extract-file="$<" --output-format=xml > $@
xidel feed.xml --extract-kind=xquery3 --extract-file="$<" --output-format=xml > $@.new
ifneq ($(XMLLINT_PATH),)
$(XMLLINT_PATH) --schema xsd/opml.xsd --noout $@.new
endif
mv $@.new $@
chmod a=r,u=rw $@
img/sprites.png: $(wildcard img/sprites/*.png)
@ -19,8 +32,12 @@ img/sprites.png: $(wildcard img/sprites/*.png)
chmod a=r,u=rw $@
css/sprites.css: xquery/build_sprites_css.xqy img/sprites.png
xidel --extract-kind=xquery3 --extract-file="$<" > $@
xidel --extract-kind=xquery3 --extract-file="$<" > $@.new
mv $@.new $@
chmod a=r,u=rw $@
validate: xquery/validator.xqy feed.xml
ifneq ($(XMLLINT_PATH),)
$(XMLLINT_PATH) --schema xsd/rss.xsd --noout feed.xml
endif
xidel --extract-kind=xquery3 --extract-file="$<"

View File

@ -20,10 +20,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/rss.xsd"
xsi:schemaLocation="
http://postneo.com/icbm xsd/icbm.xsd
https://www.nhc.noaa.gov xsd/nhc.xsd
http://backend.userland.com/blogChannelModule xsd/blogchannel.xsd
http://www.bloglines.com/about/specs/fac-1.0 xsd/fac.xsd
http://www.w3.org/2003/01/geo/wgs84_pos# xsd/geo.xsd
http://www.georss.org/georss https://schemas.opengis.net/georss/1.0/schema-1.1/georss.xsd
http://www.opengis.net/gml https://schemas.opengis.net/georss/1.0/schema-1.1/gmlgeorss.xsd
http://postneo.com/icbm xsd/icbm.xsd
https://www.nhc.noaa.gov xsd/nhc.xsd
http://purl.org/rss/1.0/modules/syndication/ xsd/syndication.xsd
http://webfeeds.org/rss/1.0 xsd/webfeeds.xsd
"
>
<channel>
@ -2018,6 +2023,21 @@ because astronomers need coffee to go through the night --&gt;
]]></description>
</item>
<item>
<title>UK Threat Level</title>
<pubDate>Sun, 26 Nov 2023 00:08:23 +0100</pubDate>
<guid isPermaLink="false">uk-threat-level</guid>
<category domain="https://envs.net/~lucidiot/rsrsss/">Feed</category>
<link>https://www.mi5.gov.uk/UKThreatLevel/UKThreatLevel.xml</link>
<description><![CDATA[
<p>As a citizen of a country that still is within the European Union, I am probably legally required to make fun of the United Kingdom, and Brexit is only one in an ever-growing list of reasons why I might want to do that. But there is one thing that I cannot complain about, and that is their government's website.</p>
<p>I could not find it anymore, but a while ago, I read a blog post about someone watching someone else use a <abbr title="PlayStation Portable">PSP</abbr> to access GOV.UK on some free Wi-Fi to do whatever business you might have on your government's website. They used that as an example of how good Web design allows accessibility, even to people whose only device might have an incredibly limited browser and who still need to fill out governement forms online. My own experience with browsing the web on a PSP teaches me that accessing any website nowadays is extremely difficult, but I am willing to believe that blog post because GOV.UK's design sounds like it could actually fit on a PSP, or at least still be readable.</p>
<p>GOV.UK's <a href="https://design-system.service.gov.uk/" target="_blank">design system</a> causes the website to often be listed on lists of "<a href="https://en.wikipedia.org/wiki/Brutalist_architecture" target="_blank">brutalist</a> websites", due to the design being all about clearly displaying what people are looking for, unlike what most heavily monetized blogs or most web apps do now.</p>
<p>But we're not here to talk about website design of course. Another interesting and much more relevant part of the UK governement website is that they have feeds, and a lot of them. Integrating the UK transport accident investigation branches into <a href="https://tilde.town/~lucidiot/itsb/" target="_blank"><abbr title="International Transport Safety Bureau">https://tilde.town/~lucidiot/itsb/</abbr></a> was trivial, just pick the right filters and get your tailored Atom feed. I have started to randomly stumble upon the feeds of other UK public bodies, and I think I'll have to soon spend more time trying to list all the feeds they have because there's a lot to discover. A lot of feeds, of XML namespaces, of relationships to European projects, and probably more.</p>
<p>Let's just start with this rather simple feed: you can get updates on the current <a href="https://www.mi5.gov.uk/threat-levels" target="_blank">national terrorist threat level</a> set by the MI5. I was both surprised at the fact that that's a feed, a feed that only gets updated at most twice a year, and at the fact that they have a separate threat level set for Northern Ireland. I'm fairly sure having a separate <a href="https://en.wikipedia.org/wiki/Vigipirate" target="_blank">Vigipirate</a> level in France for Corsican independentists would just be a self-fulfilling prophecy, causing them to attack more.</p>
<p>I naively hope the UK someday stops all its political bullshit, but only so they can keep feeding me more feeds, and inspire other countries to do the same.</p>
]]></description>
</item>
</channel>
<access:restriction relationship="allow" />

20
xquery/functions.xqy Normal file
View File

@ -0,0 +1,20 @@
xquery version "3.0" encoding "utf-8";
module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions";
(: TODO: stricter type for $outlines, to require outline elements :)
declare function rsrsss:make-opml($title as xs:string, $outlines as element(outline)*) as element(opml) {
<opml version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://envs.net/~lucidiot/rsrsss/xsd/opml.xsd">
<head>
<title>{$title}</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{$outlines}
</body>
</opml>
};

View File

@ -1,16 +1,11 @@
<opml version="2.0">
<head>
<title>Alert-Hub.org CAP alert feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"Alert-Hub.org CAP alert feeds",
(
<outline text="Sources">
{
json(fn:unparsed-text("https://alert-hub-sources.s3.amazonaws.com/json"))/sources/source
json(fn:unparsed-text("https://alert-hub-sources.s3.amazonaws.com/json"))/sources/source[capAlertFeedStatus != "bypassed"]
! <outline
type="rss"
xml:id="{sourceId}"
@ -19,7 +14,7 @@
htmlUrl="{registerUrl}"
/>
}
</outline>
</outline>,
<outline text="Generated feeds">
{
json(fn:unparsed-text("https://alert-hub-subscriptions.s3.amazonaws.com/json"))//subscriptions/subscription
@ -34,5 +29,5 @@
/>
}
</outline>
</body>
</opml>
)
)

View File

@ -1,28 +1,19 @@
<opml version="2.0">
<head>
<title>Chicago Transit Authority RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"Chicago Transit Authority RSS feeds",
(: Open the CTA RSS feeds page and grab the list items. :)
doc('https://www.transitchicago.com/rss/default.aspx')//ul[@class="rsslist"]/li
! <outline text="{substring-after(a/normalize-space(text()), 'All ')}">
{
(: Open the CTA RSS feeds page and grab the list items. :)
doc('https://www.transitchicago.com/rss/default.aspx')//ul[@class="rsslist"]/li
! <outline text="{substring-after(a/normalize-space(text()), 'All ')}">
{
(., ul/li)
! <outline
type="rss"
version="RSS"
text="{a/normalize-space(text())}"
xmlUrl="{resolve-uri(a/@href, 'https://www.transitchicago.com/rss/default.aspx')}"
language="en-us"
/>
}
</outline>
(., ul/li)
! <outline
type="rss"
version="RSS"
text="{a/normalize-space(text())}"
xmlUrl="{resolve-uri(a/@href, 'https://www.transitchicago.com/rss/default.aspx')}"
language="en-us"
/>
}
</body>
</opml>
</outline>
)

View File

@ -1,60 +1,50 @@
doc("https://feeds.enviroflash.info/")//*[contains(@class, "formrow")]//tr/
<opml version="2.0">
<head>
<title>EnviroFlash RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
.//a[ends-with(@href, ".xml")]
! <outline
type="rss"
version="Atom"
text="{text()}"
xmlUrl="{resolve-uri(@href)}"
language="en-us"
/>
}
{
for $stateCode in .//option/@value[.!="0"]
return x:parse-html(pxp:json(x:request(x:form(
<form action="https://feeds.enviroflash.info/ajax/feed_ajax.cfm" method="post">
<input name="method" value="getForecastCities" />
<input name="sStateId" value="{$stateCode}" />
</form>
))/raw)/cityBody) ! (
(: Ignore states where there are no feeds listed at all :)
if (exists(//tr[td[not(@colspan)][@id='name']])) then
<outline text="{$stateCode}">
{
//tr[td[not(@colspan)][@id='name']]
! <outline text="{td[@id='name']/text()}">
{
.//a[ends-with(@href, ".xml")]
! (
(: CAP feeds are not exactly feeds, since they only contain one alert at once and are not supported by feedreaders :)
if (starts-with(@href, "cap/")) then
<outline type="link" text="CAP feed" url="(resolve-uri(@href, 'https://feeds.enviroflash.info/'))" />
else
<outline
type="rss"
version="{upper-case(substring-before(@href, '/'))}"
text="{substring-after(./img/(@alt,@title)[1], 'View ')}"
xmlUrl="{resolve-uri(@href, 'https://feeds.enviroflash.info/')}"
language="en-us"
/>
)
}
</outline>
}
</outline>
else ()
)
}
</body>
</opml>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"EnviroFlash RSS feeds",
doc("https://feeds.enviroflash.info/")//*[contains(@class, "formrow")]//tr/
(
.//a[ends-with(@href, ".xml")]
! <outline
type="rss"
version="Atom"
text="{text()}"
xmlUrl="{resolve-uri(@href)}"
language="en-us"
/>,
for $stateCode in .//option/@value[.!="0"]
return x:parse-html(pxp:json(x:request(x:form(
<form action="https://feeds.enviroflash.info/ajax/feed_ajax.cfm" method="post">
<input name="method" value="getForecastCities" />
<input name="sStateId" value="{$stateCode}" />
</form>
))/raw)/cityBody) ! (
(: Ignore states where there are no feeds listed at all :)
if (exists(//tr[td[not(@colspan)][@id='name']])) then
<outline text="{$stateCode}">
{
//tr[td[not(@colspan)][@id='name']]
! <outline text="{td[@id='name']/text()}">
{
.//a[ends-with(@href, ".xml")]
! (
(: CAP feeds are not exactly feeds, since they only contain one alert at once and are not supported by feedreaders :)
if (starts-with(@href, "cap/")) then
<outline type="link" text="CAP feed" url="{resolve-uri(@href, 'https://feeds.enviroflash.info/')}" />
else
<outline
type="rss"
version="{upper-case(substring-before(@href, '/'))}"
text="{substring-after(./img/(@alt,@title)[1], 'View ')}"
xmlUrl="{resolve-uri(@href, 'https://feeds.enviroflash.info/')}"
language="en-us"
/>
)
}
</outline>
}
</outline>
else ()
)
)
)

View File

@ -1,36 +1,27 @@
xquery version "3.0" encoding "utf-8";
<opml version="2.0">
<head>
<title>RSRSSS curated feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
for $item in /rss/channel/item[category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()='Feed' or text()='OPML')] and link]
return element outline {
attribute type {
if (exists($item/category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()='OPML')]))
then 'include'
else 'rss'
},
attribute text {$item/title},
attribute title {$item/title},
attribute xmlUrl {$item/link},
if (exists($item/description)) then attribute description {normalize-space($item/description)} else (),
if (exists($item/pubDate)) then attribute created {$item/pubDate} else (),
let $categories := string-join(
$item/category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()!='OPML' and text()!='Feed')]/text()
! concat('/', .),
','
)
return if (string-length($categories) > 0)
then attribute category {$categories}
else ()
}
}
</body>
</opml>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"RSRSSS curated feeds",
for $item in /rss/channel/item[category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()='Feed' or text()='OPML')] and link]
return element outline {
attribute type {
if (exists($item/category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()='OPML')]))
then 'include'
else 'rss'
},
attribute text {$item/title},
attribute title {$item/title},
attribute xmlUrl {$item/link},
if (exists($item/description)) then attribute description {normalize-space($item/description)} else (),
if (exists($item/pubDate)) then attribute created {$item/pubDate} else (),
let $categories := string-join(
$item/category[@domain='https://envs.net/~lucidiot/rsrsss/' and (text()!='OPML' and text()!='Feed')]/text()
! concat('/', .),
','
)
return if (string-length($categories) > 0)
then attribute category {$categories}
else ()
}
)

View File

@ -1,26 +1,17 @@
<opml version="2.0">
<head>
<title>MeteoAlarm feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"MeteoAlarm feeds",
doc('https://feeds.meteoalarm.org/')//h2
! <outline text="{text()}">
{
doc('https://feeds.meteoalarm.org/')//h2
! <outline text="{text()}">
{
./following-sibling::ul[1]/li/a/@href
! <outline
type="rss"
xmlUrl="{.}"
text="{if (contains(., 'atom')) then 'Atom + CAP' else 'RSS'}"
version="{if (contains(., 'atom')) then 'ATOM' else 'RSS'}"
/>
}
</outline>
./following-sibling::ul[1]/li/a/@href
! <outline
type="rss"
xmlUrl="{.}"
text="{if (contains(., 'atom')) then 'Atom + CAP' else 'RSS'}"
version="{if (contains(., 'atom')) then 'ATOM' else 'RSS'}"
/>
}
</body>
</opml>
</outline>
)

View File

@ -1,31 +1,23 @@
xquery version "3.0" encoding "utf-8";
<opml version="2.0">
<head>
<title>National Data Buoy Center RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../../functions.xqy";
rsrsss:make-opml(
"National Data Buoy Center RSS feeds",
(
<outline
type="rss"
version="RSS"
text="All observations"
xmlUrl="https://www.ndbc.noaa.gov/rss/ndbc_obs_search.php?lat=0N&amp;lon=0E&amp;radius=11000"
language="en-us"
/>
{
doc("https://www.ndbc.noaa.gov/data/latest_obs/")//a[ends-with(@href, ".rss")]
! <outline
type="rss"
version="RSS"
text="{upper-case(substring-before(text(), '.rss'))}"
xmlUrl="{resolve-uri(@href)}"
language="en-us"
/>
}
</body>
</opml>
/>,
doc("https://www.ndbc.noaa.gov/data/latest_obs/")//a[ends-with(@href, ".rss")]
! <outline
type="rss"
version="RSS"
text="{upper-case(substring-before(text(), '.rss'))}"
xmlUrl="{resolve-uri(@href)}"
language="en-us"
/>
)
)

View File

@ -1,37 +1,26 @@
xquery version "3.0" encoding "utf-8";
(:
We use unparsed-text(url, encoding) instead of doc(url)
because xidel does not support changing the encoding dynamically
depending on the HTML content, so it would always use UTF-8
:)
x:parse-html(unparsed-text("https://www.nhc.noaa.gov/aboutrss.shtml", "iso-8859-1"))/
<opml version="2.0">
<head>
<title>National Hurricane Center and Central Pacific Hurricane Center RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
(:
Each feed is listed as a link with an RSS icon inside it,
followed by a text node representing the feed name,
followed by another link with the URL as its text.
Start by picking the link with the image in it…
:)
for $feed in //a[ends-with(@href, ".xml")][./img]
(: Find the text node that follows the image to get the feed name :)
let $text := substring-before($feed/following-sibling::text()[1], ":")
return <outline
type="rss"
text="{$text}"
xmlUrl="{resolve-uri($feed/@href, 'https://www.nhc.noaa.gov/aboutrss.shtml')}"
language="{if (some $word in ('Español', 'Atlantico', 'Cartera') satisfies contains($text, $word)) then 'es' else 'en-us'}"
/>
(: The only way to determine the feed's language without fetching the feeds themselves is to look for Spanish keywords. :)
}
</body>
</opml>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../../functions.xqy";
rsrsss:make-opml(
"National Hurricane Center and Central Pacific Hurricane Center RSS feeds",
(:
We use unparsed-text(url, encoding) instead of doc(url)
because xidel does not support changing the encoding dynamically
depending on the HTML content, so it would always use UTF-8.
Each feed is listed as a link with an RSS icon inside it,
followed by a text node representing the feed name,
followed by another link with the URL as its text.
Start by picking the link with the image in it…
:)
for $feed in x:parse-html(unparsed-text("https://www.nhc.noaa.gov/aboutrss.shtml", "iso-8859-1"))//a[ends-with(@href, ".xml")][./img]
(: Find the text node that follows the image to get the feed name :)
let $text := substring-before($feed/following-sibling::text()[1], ":")
return <outline
type="rss"
text="{$text}"
xmlUrl="{resolve-uri($feed/@href, 'https://www.nhc.noaa.gov/aboutrss.shtml')}"
language="{if (some $word in ('Español', 'Atlantico', 'Cartera') satisfies contains($text, $word)) then 'es' else 'en-us'}"
/>
(: The only way to determine the feed's language without fetching the feeds themselves is to look for Spanish keywords. :)
)

View File

@ -1,30 +1,13 @@
<opml version="2.0">
<head>
<title>UK National Highways RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
doc('https://nationalhighways.co.uk/travel-updates/traffic-information-rss-feeds/')//div[contains(@class, "container--section")]
! (
.//div[contains(@class, "accordion-card")]
! <outline text="{./header/a/normalize-space(text())}">
{
.//li/a[ends-with(@href, ".xml")]
! <outline
type="rss"
version="RSS"
text="{normalize-space(text())}"
xmlUrl="{resolve-uri(@href)}"
language="en-gb"
/>
}
</outline>,
.//div/h2/a
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
rsrsss:make-opml(
"UK National Highways RSS feeds",
doc('https://nationalhighways.co.uk/travel-updates/traffic-information-rss-feeds/')//div[contains(@class, "container--section")]
! (
.//div[contains(@class, "accordion-card")]
! <outline text="{./header/a/normalize-space(text())}">
{
.//li/a[ends-with(@href, ".xml")]
! <outline
type="rss"
version="RSS"
@ -32,8 +15,15 @@
xmlUrl="{resolve-uri(@href)}"
language="en-gb"
/>
)
}
</body>
</opml>
}
</outline>,
.//div/h2/a
! <outline
type="rss"
version="RSS"
text="{normalize-space(text())}"
xmlUrl="{resolve-uri(@href)}"
language="en-gb"
/>
)
)

View File

@ -1,13 +1,8 @@
<opml version="2.0">
<head>
<title>USGS Earthquake Hazards Program feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../../functions.xqy";
rsrsss:make-opml(
"USGS Earthquake Hazards Program feeds",
(
<outline text="Atom">
{
doc('https://earthquake.usgs.gov/earthquakes/feed/v1.0/atom.php')//div[h2[text() = 'Feeds']]/h3
@ -24,7 +19,7 @@
}
</outline>
}
</outline>
</outline>,
<outline text="KML">
{
doc('https://earthquake.usgs.gov/earthquakes/feed/v1.0/kml.php')//div[h2[text() = 'Automatic Feeds']]/h2
@ -45,6 +40,5 @@
</outline>
}
</outline>
</body>
</opml>
)
)

View File

@ -1,41 +1,36 @@
import module namespace rsrsss = "https://envs.net/~lucidiot/rsrsss/rsrsss-functions" at "../functions.xqy";
declare function local:get-feeds($url as xs:anyURI, $language as xs:string) as node()* {
doc(resolve-uri('./w/index.php?title=Special:SiteMatrix', $url))//link[@rel = 'alternate'][@type = 'application/rss+xml' or @type = 'application/atom+xml']
! <outline
type="rss"
text="{@title}"
version="{if (@type = 'application/atom+xml') then 'ATOM' else 'RSS'}"
xmlUrl="{resolve-uri(@href, $url)}"
htmlUrl="{$url}"
language="{$language}"
/>
! element outline {
attribute type { "rss" },
attribute text { @title },
attribute version { if (@type = 'application/atom+xml') then 'ATOM' else 'RSS' },
attribute xmlUrl { resolve-uri(@href, $url) },
attribute htmlUrl { $url },
(: Some languages are not actual language codes, like `wikidata` or `labs` or `wikimania2008`, so we do not include them :)
if (fn:matches($language, "\d|^\w{4,}"))
then ()
else attribute { "language" } { $language }
}
};
doc('https://commons.wikimedia.org/w/api.php?action=sitematrix&amp;format=xml')//sitematrix
! <opml version="2.0">
<head>
<title>Wikimedia RSS feeds</title>
<dateModified>{format-dateTime(adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration("PT0S")), "[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] GMT")}</dateModified>
<ownerName>lucidiot</ownerName>
<ownerEmail>lucidiot@envs.net</ownerEmail>
<ownerId>https://tilde.town/~lucidiot/contact.html</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
{
for $language in ./language
return <outline text="{$language/@localname}">
{
$language/site/site[not(@private)]
! local:get-feeds(@url, $language/@code)
}
</outline>
}
rsrsss:make-opml(
"Wikimedia RSS feeds",
doc('https://commons.wikimedia.org/w/api.php?action=sitematrix&amp;format=xml')//sitematrix
! (
for $language in ./language
return <outline text="{$language/@localname}">
{
$language/site/site[not(@private)]
! local:get-feeds(@url, $language/@code)
}
</outline>,
<outline text="Specials">
{
./specials/special[not(@private)]
! local:get-feeds(@url, @lang)
}
</outline>
</body>
</opml>
)
)

70
xsd/blogchannel.xsd Normal file
View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
blogChannel RSS Module XML schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
targetNamespace="http://backend.userland.com/blogChannelModule"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://backend.userland.com/blogChannelModule"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
<xs:documentation>blogChannel RSS Module XML schema</xs:documentation>
<xs:documentation>
<![CDATA[Derived from the documentation at <http://backend.userland.com/blogChannelModule>]]>
</xs:documentation>
</xs:annotation>
<xs:element name="blogRoll" type="xs:anyURI">
<xs:annotation>
<xs:documentation>URL of an OPML file containing the blogroll for this website.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="mySubscriptions" type="xs:anyURI">
<xs:annotation>
<xs:documentation>
URL of an OPML file containing the RSS feed subscriptions of the website's managing editor.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="blink" type="xs:anyURI">
<xs:annotation>
<xs:documentation>
URL of a weblog that this website's managing editor is promoting, per Mark Pilgrim's description.
</xs:documentation>
<xs:documentation>
<![CDATA[See <http://web.archive.org/web/20021210024956/http://diveintomark.org:80/archives/2002/09/17.html>]]>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="changes" type="xs:anyURI">
<xs:annotation>
<xs:documentation>URL of a changes.xml file.</xs:documentation>
<xs:documentation>
When the feed that contains this element updates, it pings a server that updates this file.
The presence of this element says to aggregators that they only have to read the changes file to see if this feed has updated.
If several feeds point to the same changes file, the aggregator has to do less polling, resulting in better use of server bandwidth, and the Internet as a whole; and resulting in faster scans.
</xs:documentation>
<xs:documentation>
<![CDATA[See <https://web.archive.org/web/20180131140150/http://xmlrpc.scripting.com/weblogsComForRss.html>]]>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

69
xsd/fac.xsd Normal file
View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Feed Access Control 1.0 XML schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
targetNamespace="http://www.bloglines.com/about/specs/fac-1.0"
version="1.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.bloglines.com/about/specs/fac-1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
<xs:documentation>Feed Access Control 1.0 XML schema</xs:documentation>
<xs:documentation>
<![CDATA[Derived from the documentation archived at <https://web.archive.org/web/20080101062756/http://www.bloglines.com/about/specs/fac-1.0>]]>
</xs:documentation>
</xs:annotation>
<xs:simpleType name="AccessRestrictionRelationship">
<xs:annotation>
<xs:documentation>Defines the currently applied redistribution rules.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="allow">
<xs:annotation>
<xs:documentation>Allow redistributing this feed to other public sources, including search.</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="deny">
<xs:annotation>
<xs:documentation>Deny redistributing this feed to other public sources, including search.</xs:documentation>
<xs:documentation>
Note that the original specification does not say whether or not an aggregator
should delete any previous redistributions of the feed when this value is set.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AccessRestriction">
<xs:annotation>
<xs:documentation>Defines whether this feed allows or denies redistribution to other public sources, including search.</xs:documentation>
<xs:documentation>When this element is missing from a feed, feed aggregators should default to a relationship value of `allow`.</xs:documentation>
<xs:documentation>
When the relationship value was previously set to `deny`, and the element gets removed,
feed aggregators should continue applying the `deny` value until a value of `allow` is explicitly set.
Removing the element is not enough to resume allowing redistribution.
</xs:documentation>
</xs:annotation>
<xs:attribute name="relationship" type="AccessRestrictionRelationship" use="required" />
</xs:complexType>
<xs:element name="restriction" type="AccessRestriction" />
</xs:schema>

56
xsd/geo.xsd Normal file
View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
W3C Basic Geo (WGS84 lat/long) Vocabulary XML schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
targetNamespace="http://www.w3.org/2003/01/geo/wgs84_pos#"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:simpleType name="Latitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-90" />
<xs:maxInclusive value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Longitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-180" />
<xs:maxInclusive value="180" />
</xs:restriction>
</xs:simpleType>
<xs:element name="lat" type="Latitude">
<xs:annotation>
<xs:documentation>Latitude of the location being referred to by this channel or item, in WGS84.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="long" type="Longitude">
<xs:annotation>
<xs:documentation>Longitude of the location being referred to by this channel or item, in WGS84.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="alt" type="xs:decimal">
<xs:annotation>
<xs:documentation>Elevation of the location being referred to by this channel or item, in WGS84.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

View File

@ -24,15 +24,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
>
<xs:simpleType name="Latitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-90" ></xs:minInclusive>
<xs:maxInclusive value="90" ></xs:maxInclusive>
<xs:minInclusive value="-90" />
<xs:maxInclusive value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Longitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-180" ></xs:minInclusive>
<xs:maxInclusive value="180" ></xs:maxInclusive>
<xs:minInclusive value="-180" />
<xs:maxInclusive value="180" />
</xs:restriction>
</xs:simpleType>

View File

@ -136,7 +136,7 @@ and the RSS examples at <https://www.nhc.noaa.gov/rss_examples/>
<xs:documentation>Location of the center of the weather system, as a WGS84 latitude and longitude.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="type" type="CycloneTypeType">
<xs:annotation>
<xs:documentation>Type of the weather system. Not all possible values are known.</xs:documentation>

352
xsd/opml.xsd Normal file
View File

@ -0,0 +1,352 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Outline Processor Markup Language 2.0 schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0"
>
<xs:annotation>
<xs:documentation>
Outline Processor Markup Language 2.0 XML Schema
</xs:documentation>
<xs:documentation>
<![CDATA[Derived from the specification at <http://opml.org/spec2.html>]]>
</xs:documentation>
</xs:annotation>
<xs:complexType name="OPML">
<xs:sequence>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="head" type="Head" minOccurs="1" maxOccurs="1" />
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="body" type="Body" minOccurs="1" maxOccurs="1" />
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required" fixed="2.0" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:simpleType name="RFC822Date">
<xs:restriction base="xs:string">
<xs:pattern value="((Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s*)?\d\d?\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d\d(\d\d)?\s+\d\d:\d\d(:\d\d)?\s+([+\-]?\d\d\d\d|[A-Z]{2,3})" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="EmailAddress">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_\-][a-zA-Z0-9_.\-]*@[a-zA-Z0-9_\-][a-zA-Z0-9_.\-]*" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Head">
<xs:all>
<xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="dateCreated" type="RFC822Date" minOccurs="0" maxOccurs="1" />
<xs:element name="dateModified" type="RFC822Date" minOccurs="0" maxOccurs="1" />
<xs:element name="ownerName" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="ownerEmail" type="EmailAddress" minOccurs="0" maxOccurs="1" />
<xs:element name="ownerId" type="xs:anyURI" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Address of a web page that identifies the author or allows contacting them.
</xs:documentation>
<xs:documentation>
No two authors have the same ownerId.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="docs" type="xs:anyURI" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Address of the specification for the OPML file format.
</xs:documentation>
<xs:documentation>
<![CDATA[The recommended value is <http://opml.org/spec2.opml>.]]>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="expansionState" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Comma-separated list of line numbers indicating which outline elements should be in an expanded state.
</xs:documentation>
<xs:documentation>
Expanding an outline will change the line numbers of the outlines below, allowing to expand outlines recursively.
</xs:documentation>
<xs:documentation>
Child outlines of non-expanded outlines cannot be stored as expanded.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vertScrollState" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Line number of the outline element that should be at the top of the window, calculated after the expansion state is already applied.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="windowTop" type="xs:integer" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Location of the top edge of the outliner's window, in pixels.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="windowLeft" type="xs:integer" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Location of the left edge of the outliner's window, in pixels.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="windowBottom" type="xs:integer" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Location of the bottom edge of the outliner's window, in pixels.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="windowRight" type="xs:integer" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Location of the right edge of the outliner's window, in pixels.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:complexType name="Body">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="outline" type="Outline" />
<xs:any namespace="##other" processContents="lax" />
</xs:choice>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:attributeGroup name="LinkIncludeAttributes">
<xs:annotation>
<xs:documentation>
Attributes that are defined for `type="link"` and `type="include"` outlines.
</xs:documentation>
<xs:documentation>
XSD 1.0 does not allow us to restrict those attributes to those two types.
</xs:documentation>
</xs:annotation>
<xs:attribute name="url" type="xs:anyURI" use="optional" />
</xs:attributeGroup>
<xs:simpleType name="RSSVersion">
<xs:annotation>
<xs:documentation>
Format and version of a feed described in a `type="rss"` outline.
</xs:documentation>
</xs:annotation>
<!-- Use a union to allow any string, but still suggest some known values -->
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="RSS">
<xs:annotation>
<xs:documentation>
Recommended value for Really Simple Syndication 0.91, 0.92 or 2.0.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="RSS1">
<xs:annotation>
<xs:documentation>
Recommended value for RDF Site Summary 1.0.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="scriptingNews">
<xs:annotation>
<xs:documentation>
Recommended value for the Scripting News format.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="ATOM">
<xs:annotation>
<xs:documentation>
Recommended value for Atom 1.0.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:attributeGroup name="RSSAttributes">
<xs:annotation>
<xs:documentation>
Attributes that are defined for `type="rss"` outlines.
</xs:documentation>
<xs:documentation>
XSD 1.0 does not allow us to restrict those attributes to this type.
</xs:documentation>
</xs:annotation>
<xs:attribute name="xmlUrl" type="xs:anyURI" use="optional">
<xs:annotation>
<xs:documentation>
URL of the feed. This is required when using a `type="rss"` outline.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="htmlUrl" type="xs:anyURI" use="optional">
<xs:annotation>
<xs:documentation>
<![CDATA[URL reported as the <link> element of the RSS feed's channel, for `type="rss"` outlines.]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="title" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<![CDATA[Contents of the <title> element of the RSS feed's channel, for `type="rss"` outlines.]]>
</xs:documentation>
<xs:documentation>
While `text` can contain a user-defined feed name, `title` should always contain the original title of the feed.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="version" type="RSSVersion" use="optional">
<xs:annotation>
<xs:documentation>
<![CDATA[Format and version of feed, for `type="rss"` outlines.]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="language" type="xs:language" use="optional">
<xs:annotation>
<xs:documentation>
<![CDATA[Language code reported as the <language> element of the RSS feed's channel, for `type="rss"` outlines.]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="description" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<![CDATA[Contents of the <description> element of the RSS feed's channel, for `type="rss"` outlines.]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:simpleType name="OutlineType">
<xs:annotation>
<xs:documentation>
The type of an outline element.
</xs:documentation>
<xs:documentation>
An outline without a type is considered to be either a simple text outline if it does not contain any child outlines, or a directory.
</xs:documentation>
</xs:annotation>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="link">
<xs:annotation>
<xs:documentation>
A link to an online resource. Link outlines must have a `url` attribute.
</xs:documentation>
<xs:documentation>
When the link's URL ends with `.opml`, this outline behaves like an `include` outline, with the OPML file getting downloaded and this outline getting replaced with the OPML file's contents.
</xs:documentation>
<xs:documentation>
Otherwise, this outline should be rendered as a clickable link to any other resource.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="include">
<xs:annotation>
<xs:documentation>
A link to an OPML file. The `url` attribute must be set to the URL of the OPML file. The OPML file should be downloaded, and this outline should be replaced with its contents.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="rss">
<xs:annotation>
<xs:documentation>
A syndication feed. The `xmlUrl` attribute must be set to the URL of the feed. The `description`, `htmlUrl`, `language`, `title` and `version` attributes may be set to provide additional information.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:complexType name="Outline">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="outline" type="Outline" />
<xs:any namespace="##other" processContents="lax" />
</xs:choice>
<xs:attribute name="type" type="OutlineType" use="optional" />
<xs:attribute name="text" type="xs:string" use="required" />
<xs:attribute name="isComment" type="xs:boolean" use="optional" default="false">
<xs:annotation>
<xs:documentation>
Whether this outline is commented. If an outline is commented, all its child outlines are implicitly commented.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="isBreakpoint" type="xs:boolean" use="optional" default="false">
<xs:annotation>
<xs:documentation>
Whether or not a breakpoint is set on this outline. This is mostly used for outlines that allow editing scripts.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="created" type="RFC822Date" use="optional">
<xs:annotation>
<xs:documentation>
Date of creation of this outline.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="category" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Comma-separated list of categories and tags, in a format similar to the Really Simple Syndication 2.0 category element.
</xs:documentation>
<xs:documentation>
A category starts with a slash, and a hierarchy of sub-categories can be defined: /Formats/OPML/2.0
</xs:documentation>
<xs:documentation>
A tag does not start with a slash, and there is no hierarchy.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="LinkIncludeAttributes" />
<xs:attributeGroup ref="RSSAttributes" />
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
<xs:element name="opml" type="OPML" />
</xs:schema>

View File

@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Changes from the upstream at <https://github.com/jthelin/rss2schema>:
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
version="2.0.2.19">
<xs:annotation>
<xs:documentation>XML Schema for RSS v2.0 feed files.</xs:documentation>
@ -206,10 +206,10 @@ Changes from the upstream at <https://github.com/jthelin/rss2schema>:
</xs:any>
</xs:choice>
<xs:element name="item" type="RssItem" minOccurs="1" maxOccurs="unbounded">
<!--
HACK: According to the RSS 2.0 spec, it should strictly be possible to have zero item elements,
<!--
HACK: According to the RSS 2.0 spec, it should strictly be possible to have zero item elements,
but this makes the schema non-deterministic with regard to extensibility elements
so for the moment we undid bug-fix 10231 and set minOccurs=1 to work around this problem.
so for the moment we undid bug-fix 10231 and set minOccurs=1 to work around this problem.
-->
</xs:element>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
@ -432,30 +432,30 @@ Date Revision Description
- Use namespace="##other" on <any>'s to create a more deterministic data model.
- Added missing xs:documentation inside xs:annotation at the schema level.
- Use xs:language for ISO Language Codes in <language> element.
- Change guid to a single declaration. This loses some of the checking of the
URL when the contents of the guid is a permaLink, so we will need to add
- Change guid to a single declaration. This loses some of the checking of the
URL when the contents of the guid is a permaLink, so we will need to add
that back in with a regexp pattern.
14-Apr-2003 3 Changes to solve some element ordering problems.
- Use xs:all in place of xs:sequence to support flexible ordering of elements.
Although the ordering constraints for elements is not clear from the
original specification, the custom and practice seems to be that
Although the ordering constraints for elements is not clear from the
original specification, the custom and practice seems to be that
element ordering is free-form.
- Use elementFormDefault="qualified" for explicit intent.
15-Apr-2003 4 Changes to solve some element ordering problems.
- Use xs:choice in place of xs:all as previous usage of <all> was invalid.
This creates the problem that insufficient constraints can be applied
This creates the problem that insufficient constraints can be applied
by the schema - for example, it can't prevent two title elements for an item.
- Use elementFormDefault="unqualified" for to get the correct behaviours
- Use elementFormDefault="unqualified" for to get the correct behaviours
when importing and combining schemas.
15-Apr-2003 5 Putting the extensibility element inside the repeating choice solves
15-Apr-2003 5 Putting the extensibility element inside the repeating choice solves
all problems with element ordering.
15-Apr-2003 6 - skipHours and skipDays should contain a nested list of values,
15-Apr-2003 6 - skipHours and skipDays should contain a nested list of values,
not just a single value.
- Added version attribute to schema definition.
- Corrected type of the cloud element
25-Apr-2003 7 - Add regexp for RFC-822 date suggested by Sam Ruby
- I had to leave the base type of the tRfc822FormatDate type
as xs:string due to the problems with using
- I had to leave the base type of the tRfc822FormatDate type
as xs:string due to the problems with using
a pattern with xs:dateTime described at
http://www.thearchitect.co.uk/weblog/archives/2003/04/000142.html
19-Jun-2003 8 - Fixed a bug that the Oxygen XML Editor spotted in the regexp for RFC-822 dates
@ -464,11 +464,11 @@ Date Revision Description
24-Jun-2003 10 - Missing types for item/title and item/description - Spotted by Andreas Schwotzer.
01-Jan-2008 11 - Copy made available under the Microsoft Public License (MS-PL).
25-May-2008 12 - Bug fix 10231 from Ken Gruven - channel can contain zero or more items.
06-Sep-2008 13 - Fixed tab-space whitespace issues. Now always use spaces.
- Undid the fix for bug-fix 10231 since it made the schema non-deterministic
06-Sep-2008 13 - Fixed tab-space whitespace issues. Now always use spaces.
- Undid the fix for bug-fix 10231 since it made the schema non-deterministic
with respect to extensibility elements in tRssChannel - need to reconsider the fix.
08-Sep-2008 14 - Removed 't' prefixes from type names to improve class names
that get code-generated from the schema.
08-Sep-2008 14 - Removed 't' prefixes from type names to improve class names
that get code-generated from the schema.
22-Sep-2008 15 - Move type def for rss element in-line for improved compatibility with Java 1.6 tools.
01-Nov-2008 16 - Added the missing rating element from the spec to RssChannel.
04-Sep-2019 17 - Fixed some minor typos in comments and messages.

View File

@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
version="1.0"
elementFormDefault="qualified"
xmlns="http://purl.org/rss/1.0/modules/servicestatus/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
@ -41,10 +40,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</xs:restriction>
</xs:simpleType>
<xs:element name="aboutStats" type="rdf:resource">
<xs:element name="aboutStats" type="xs:anyURI">
<xs:annotation>
<xs:documentation>Resource describing how the availability percentage and average response time are calculated.</xs:documentation>
<xs:documentation>URI of an RDF resource describing how the availability percentage and average response time are calculated.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
<xs:documentation>
Note that the original specification says this is an RDF resource, which may be represented in ways other than a simple URI string in an element.
For example, the channel element could have an aboutStats attribute instead, or the element could contain an rdf:Description element, or it could use an `rdf:resource` attribute instead.
However, since the specification only used an element with a string URI in its examples,
and the Service Status module may be mixed in with documents other than RDF Site Summary feeds,
only that representation will be considered valid to avoid any interoperability issues.
</xs:documentation>
</xs:annotation>
</xs:element>
@ -62,14 +68,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</xs:annotation>
</xs:element>
<xs:element name="lastChecked" type="xs:datetime">
<xs:element name="lastChecked" type="xs:dateTime">
<xs:annotation>
<xs:documentation>The most recent time that the service was checked, no matter how the service responded.</xs:documentation>
<xs:documentation>This should be added to an item element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="lastSeen" type="xs:datetime">
<xs:element name="lastSeen" type="xs:dateTime">
<xs:annotation>
<xs:documentation>The most recent time that the service has successfully responded.</xs:documentation>
<xs:documentation>This should be added to an item element.</xs:documentation>

71
xsd/syndication.xsd Normal file
View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
RDF Site Summary 1.0 Syndication Module 1.4.1 XML schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
targetNamespace="http://purl.org/rss/1.0/modules/syndication/"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.4.1"
xmlns="http://purl.org/rss/1.0/modules/syndication/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
<xs:documentation>RDF Site Summary 1.0 Syndication Module 1.4.1 XML schema</xs:documentation>
<xs:documentation>
<![CDATA[Derived from the specification at <https://web.resource.org/rss/1.0/modules/syndication/>]]>
</xs:documentation>
</xs:annotation>
<xs:simpleType name="UpdatePeriod">
<xs:annotation>
<xs:documentation>Period over which the channel format is updated.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="hourly" />
<xs:enumeration value="daily" />
<xs:enumeration value="weekly" />
<xs:enumeration value="monthly" />
<xs:enumeration value="yearly" />
</xs:restriction>
</xs:simpleType>
<xs:element name="updatePeriod" type="UpdatePeriod" default="daily" />
<xs:element name="updateFrequency" type="xs:positiveInteger" default="1">
<xs:annotation>
<xs:documentation>Frequency of updates in relation to the update period.</xs:documentation>
<xs:documentation>A positive integer indicates how many times in that period the channel is updated.</xs:documentation>
<xs:documentation>For example, an updatePeriod of daily, and an updateFrequency of 2 indicates the channel format is updated twice daily.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:simpleType name="W3CDateTimeMinutes">
<xs:annotation>
<xs:documentation>A date and time that follows the W3C note on Date and Time formats, and has a precision in minutes.</xs:documentation>
<xs:documentation><![CDATA[See <https://www.w3.org/TR/NOTE-datetime>]]></xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="\d\d\d\d-(0\d|1[0-2])-([0-2]\d|3[01])T([01]\d|2[0-3]):[0-5]\d(Z|[+-]([01]\d|2[0-3]):[0-5]\d)" />
</xs:restriction>
</xs:simpleType>
<xs:element name="updateBase" type="W3CDateTimeMinutes">
<xs:annotation>
<xs:documentation>Base date to be used in concert with updatePeriod and updateFrequency to calculate the publishing schedule.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>

125
xsd/webfeeds.xsd Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Webfeeds XML schema
Copyright (c) 2023 ~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/>.
-->
<xs:schema
targetNamespace="http://webfeeds.org/rss/1.0"
version="1.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://webfeeds.org/rss/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
<xs:documentation>Webfeeds 1.0 XML schema</xs:documentation>
<xs:documentation><![CDATA[Derived from the DTD at <http://webfeeds.org/rss/1.0>]]></xs:documentation>
</xs:annotation>
<xs:simpleType name="Color">
<xs:annotation>
<xs:documentation>An RGB color, as six hexadecimal digits.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:length value="6" />
<xs:pattern value="[0-9a-fA-F]{6}" />
</xs:restriction>
</xs:simpleType>
<xs:element name="accentColor" type="Color">
<xs:annotation>
<xs:documentation>Accent color used to customize this feed's appearance within a feed reader.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:simpleType name="AnalyticsEngine">
<xs:annotation>
<xs:documentation>An engine for site analytics.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="GoogleAnalytics" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Analytics">
<xs:annotation>
<xs:documentation>When this is configured, feed readers should report back events for various user actions.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
<xs:documentation>There are no further details on how the reports are made or what exactly is being reported.</xs:documentation>
</xs:annotation>
<xs:attribute name="id" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>A string used to identify this feed uniquely within the analytics engine.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="engine" type="AnalyticsEngine" use="optional" default="GoogleAnalytics">
<xs:annotation>
<xs:documentation>Which analytics engine to send reports to.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:element name="analytics" type="Analytics" />
<xs:complexType name="Cover">
<xs:annotation>
<xs:documentation>A cover image, a large rectangular image used as a background in feed headers.</xs:documentation>
</xs:annotation>
<xs:attribute name="image" type="xs:anyURI" use="required">
<xs:annotation>
<xs:documentation>URI to the cover image.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:element name="cover" type="Cover" />
<xs:element name="wordmark" type="xs:anyURI">
<xs:annotation>
<xs:documentation>URL of a small rectangular image used to represent the feed.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="icon" type="xs:anyURI">
<xs:annotation>
<xs:documentation>URL of a small square image, similar to an `apple-touch-icon.png` file, to represent the feed's icon.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="partial" type="xs:boolean">
<xs:annotation>
<xs:documentation>Whether this feed only includes a portion of the website's contents.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="deprecated" type="xs:boolean">
<xs:annotation>
<xs:documentation>Whether this feed is no longer the primary feed for the related website.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="promotion" type="xs:string">
<xs:annotation>
<xs:documentation>Promotional HTML content that should be added to the end of every item within this feed.</xs:documentation>
<xs:documentation>This should be added to the channel element.</xs:documentation>
<xs:documentation>This element can be used multiple times. Feed readers should pick one element at random to be displayed after an item.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>