diff options
author | Brion Vibber <brion@pobox.com> | 2009-11-20 09:42:19 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2009-11-20 09:42:19 -0800 |
commit | b189c9500c3ea5362edfcbf818c2f847b4892da5 (patch) | |
tree | 760ed684d9595b872ec3258ff338c5cf22e27bf0 /plugins/FeedSub/extlib/XML/Feed/schemas | |
parent | d645db38ae4ff4179f7fc31d4501d48054c4b8e6 (diff) |
Initial functional version of feed subscription plugin, currently supporting only PuSH-enabled feeds.
Diffstat (limited to 'plugins/FeedSub/extlib/XML/Feed/schemas')
-rwxr-xr-x | plugins/FeedSub/extlib/XML/Feed/schemas/atom.rnc | 338 | ||||
-rwxr-xr-x | plugins/FeedSub/extlib/XML/Feed/schemas/rss10.rnc | 113 | ||||
-rwxr-xr-x | plugins/FeedSub/extlib/XML/Feed/schemas/rss11.rnc | 218 |
3 files changed, 669 insertions, 0 deletions
diff --git a/plugins/FeedSub/extlib/XML/Feed/schemas/atom.rnc b/plugins/FeedSub/extlib/XML/Feed/schemas/atom.rnc new file mode 100755 index 000000000..e662d2626 --- /dev/null +++ b/plugins/FeedSub/extlib/XML/Feed/schemas/atom.rnc @@ -0,0 +1,338 @@ +# -*- rnc -*- +# RELAX NG Compact Syntax Grammar for the +# Atom Format Specification Version 11 + +namespace atom = "http://www.w3.org/2005/Atom" +namespace xhtml = "http://www.w3.org/1999/xhtml" +namespace s = "http://www.ascc.net/xml/schematron" +namespace local = "" + +start = atomFeed | atomEntry + +# Common attributes + +atomCommonAttributes = + attribute xml:base { atomUri }?, + attribute xml:lang { atomLanguageTag }?, + undefinedAttribute* + +# Text Constructs + +atomPlainTextConstruct = + atomCommonAttributes, + attribute type { "text" | "html" }?, + text + +atomXHTMLTextConstruct = + atomCommonAttributes, + attribute type { "xhtml" }, + xhtmlDiv + +atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct + +# Person Construct + +atomPersonConstruct = + atomCommonAttributes, + (element atom:name { text } + & element atom:uri { atomUri }? + & element atom:email { atomEmailAddress }? + & extensionElement*) + +# Date Construct + +atomDateConstruct = + atomCommonAttributes, + xsd:dateTime + +# atom:feed + +atomFeed = + [ + s:rule [ + context = "atom:feed" + s:assert [ + test = "atom:author or not(atom:entry[not(atom:author)])" + "An atom:feed must have an atom:author unless all " + ~ "of its atom:entry children have an atom:author." + ] + ] + ] + element atom:feed { + atomCommonAttributes, + (atomAuthor* + & atomCategory* + & atomContributor* + & atomGenerator? + & atomIcon? + & atomId + & atomLink* + & atomLogo? + & atomRights? + & atomSubtitle? + & atomTitle + & atomUpdated + & extensionElement*), + atomEntry* + } + +# atom:entry + +atomEntry = + [ + s:rule [ + context = "atom:entry" + s:assert [ + test = "atom:link[@rel='alternate'] " + ~ "or atom:link[not(@rel)] " + ~ "or atom:content" + "An atom:entry must have at least one atom:link element " + ~ "with a rel attribute of 'alternate' " + ~ "or an atom:content." + ] + ] + s:rule [ + context = "atom:entry" + s:assert [ + test = "atom:author or " + ~ "../atom:author or atom:source/atom:author" + "An atom:entry must have an atom:author " + ~ "if its feed does not." + ] + ] + ] + element atom:entry { + atomCommonAttributes, + (atomAuthor* + & atomCategory* + & atomContent? + & atomContributor* + & atomId + & atomLink* + & atomPublished? + & atomRights? + & atomSource? + & atomSummary? + & atomTitle + & atomUpdated + & extensionElement*) + } + +# atom:content + +atomInlineTextContent = + element atom:content { + atomCommonAttributes, + attribute type { "text" | "html" }?, + (text)* + } + +atomInlineXHTMLContent = + element atom:content { + atomCommonAttributes, + attribute type { "xhtml" }, + xhtmlDiv + } + +atomInlineOtherContent = + element atom:content { + atomCommonAttributes, + attribute type { atomMediaType }?, + (text|anyElement)* + } + +atomOutOfLineContent = + element atom:content { + atomCommonAttributes, + attribute type { atomMediaType }?, + attribute src { atomUri }, + empty + } + +atomContent = atomInlineTextContent + | atomInlineXHTMLContent + | atomInlineOtherContent + | atomOutOfLineContent + +# atom:author + +atomAuthor = element atom:author { atomPersonConstruct } + +# atom:category + +atomCategory = + element atom:category { + atomCommonAttributes, + attribute term { text }, + attribute scheme { atomUri }?, + attribute label { text }?, + undefinedContent + } + +# atom:contributor + +atomContributor = element atom:contributor { atomPersonConstruct } + +# atom:generator + +atomGenerator = element atom:generator { + atomCommonAttributes, + attribute uri { atomUri }?, + attribute version { text }?, + text +} + +# atom:icon + +atomIcon = element atom:icon { + atomCommonAttributes, + (atomUri) +} + +# atom:id + +atomId = element atom:id { + atomCommonAttributes, + (atomUri) +} + +# atom:logo + +atomLogo = element atom:logo { + atomCommonAttributes, + (atomUri) +} + +# atom:link + +atomLink = + element atom:link { + atomCommonAttributes, + attribute href { atomUri }, + attribute rel { atomNCName | atomUri }?, + attribute type { atomMediaType }?, + attribute hreflang { atomLanguageTag }?, + attribute title { text }?, + attribute length { text }?, + undefinedContent + } + +# atom:published + +atomPublished = element atom:published { atomDateConstruct } + +# atom:rights + +atomRights = element atom:rights { atomTextConstruct } + +# atom:source + +atomSource = + element atom:source { + atomCommonAttributes, + (atomAuthor* + & atomCategory* + & atomContributor* + & atomGenerator? + & atomIcon? + & atomId? + & atomLink* + & atomLogo? + & atomRights? + & atomSubtitle? + & atomTitle? + & atomUpdated? + & extensionElement*) + } + +# atom:subtitle + +atomSubtitle = element atom:subtitle { atomTextConstruct } + +# atom:summary + +atomSummary = element atom:summary { atomTextConstruct } + +# atom:title + +atomTitle = element atom:title { atomTextConstruct } + +# atom:updated + +atomUpdated = element atom:updated { atomDateConstruct } + +# Low-level simple types + +atomNCName = xsd:string { minLength = "1" pattern = "[^:]*" } + +# Whatever a media type is, it contains at least one slash +atomMediaType = xsd:string { pattern = ".+/.+" } + +# As defined in RFC 3066 +atomLanguageTag = xsd:string { + pattern = "[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*" +} + +# Unconstrained; it's not entirely clear how IRI fit into +# xsd:anyURI so let's not try to constrain it here +atomUri = text + +# Whatever an email address is, it contains at least one @ +atomEmailAddress = xsd:string { pattern = ".+@.+" } + +# Simple Extension + +simpleExtensionElement = + element * - atom:* { + text + } + +# Structured Extension + +structuredExtensionElement = + element * - atom:* { + (attribute * { text }+, + (text|anyElement)*) + | (attribute * { text }*, + (text?, anyElement+, (text|anyElement)*)) + } + +# Other Extensibility + +extensionElement = + simpleExtensionElement | structuredExtensionElement + +undefinedAttribute = + attribute * - (xml:base | xml:lang | local:*) { text } + +undefinedContent = (text|anyForeignElement)* + +anyElement = + element * { + (attribute * { text } + | text + | anyElement)* + } + +anyForeignElement = + element * - atom:* { + (attribute * { text } + | text + | anyElement)* + } + +# XHTML + +anyXHTML = element xhtml:* { + (attribute * { text } + | text + | anyXHTML)* +} + +xhtmlDiv = element xhtml:div { + (attribute * { text } + | text + | anyXHTML)* +} + +# EOF
\ No newline at end of file diff --git a/plugins/FeedSub/extlib/XML/Feed/schemas/rss10.rnc b/plugins/FeedSub/extlib/XML/Feed/schemas/rss10.rnc new file mode 100755 index 000000000..725094788 --- /dev/null +++ b/plugins/FeedSub/extlib/XML/Feed/schemas/rss10.rnc @@ -0,0 +1,113 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html --> +<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html --> +<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html --> + +<grammar xmlns='http://relaxng.org/ns/structure/1.0' + xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' + ns='http://purl.org/rss/1.0/' + datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'> + + <start> + <element name='RDF' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <ref name='RDFContent'/> + </element> + </start> + + <define name='RDFContent' ns='http://purl.org/rss/1.0/'> + <interleave> + <element name='channel'> + <ref name='channelContent'/> + </element> + <optional> + <element name='image'><ref name='imageContent'/></element> + </optional> + <oneOrMore> + <element name='item'><ref name='itemContent'/></element> + </oneOrMore> + </interleave> + </define> + + <define name='channelContent' combine="interleave"> + <interleave> + <element name='title'><data type='string'/></element> + <element name='link'><data type='anyURI'/></element> + <element name='description'><data type='string'/></element> + <element name='image'> + <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <data type='anyURI'/> + </attribute> + </element> + <element name='items'> + <ref name='itemsContent'/> + </element> + <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <data type='anyURI'/> + </attribute> + </interleave> + </define> + + <define name="itemsContent"> + <element name="Seq" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <oneOrMore> + <element name="li" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <choice> + <attribute name='resource'> <!-- Why doesn't RDF/RSS1.0 ns qualify this attribute? --> + <data type='anyURI'/> + </attribute> + <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <data type='anyURI'/> + </attribute> + </choice> + </element> + </oneOrMore> + </element> + </define> + + <define name='imageContent'> + <interleave> + <element name='title'><data type='string'/></element> + <element name='link'><data type='anyURI'/></element> + <element name='url'><data type='anyURI'/></element> + <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <data type='anyURI'/> + </attribute> + </interleave> + </define> + + <define name='itemContent'> + <interleave> + <element name='title'><data type='string'/></element> + <element name='link'><data type='anyURI'/></element> + <optional><element name='description'><data type='string'/></element></optional> + <ref name="anyThing"/> + <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'> + <data type='anyURI'/> + </attribute> + </interleave> + </define> + + + <define name='anyThing'> + <zeroOrMore> + <choice> + <text/> + <element> + <anyName> + <except> + <nsName/> + </except> + </anyName> + <ref name='anyThing'/> + <zeroOrMore> + <attribute> + <anyName/> + </attribute> + </zeroOrMore> + </element> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/plugins/FeedSub/extlib/XML/Feed/schemas/rss11.rnc b/plugins/FeedSub/extlib/XML/Feed/schemas/rss11.rnc new file mode 100755 index 000000000..c8633766f --- /dev/null +++ b/plugins/FeedSub/extlib/XML/Feed/schemas/rss11.rnc @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + RELAX NG Compact Schema for RSS 1.1 + Sean B. Palmer, inamidst.com + Christopher Schmidt, crschmidt.net + License: This schema is in the public domain +--> +<grammar xmlns:rss="http://purl.org/net/rss1.1#" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ns="http://purl.org/net/rss1.1#" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="Channel"/> + </start> + <define name="Channel"> + <a:documentation>http://purl.org/net/rss1.1#Channel</a:documentation> + <element name="Channel"> + <ref name="Channel.content"/> + + </element> + </define> + <define name="Channel.content"> + <optional> + <ref name="AttrXMLLang"/> + </optional> + <optional> + <ref name="AttrXMLBase"/> + </optional> + + <ref name="AttrRDFAbout"/> + <interleave> + <ref name="title"/> + <ref name="link"/> + <ref name="description"/> + <optional> + <ref name="image"/> + </optional> + <zeroOrMore> + + <ref name="Any"/> + </zeroOrMore> + <ref name="items"/> + </interleave> + </define> + <define name="title"> + <a:documentation>http://purl.org/net/rss1.1#title</a:documentation> + <element name="title"> + + <ref name="title.content"/> + </element> + </define> + <define name="title.content"> + <optional> + <ref name="AttrXMLLang"/> + </optional> + <text/> + </define> + + <define name="link"> + <a:documentation>http://purl.org/net/rss1.1#link</a:documentation> + <element name="link"> + <ref name="link.content"/> + </element> + </define> + <define name="link.content"> + <data type="anyURI"/> + + </define> + <define name="description"> + <a:documentation>http://purl.org/net/rss1.1#description</a:documentation> + <element name="description"> + <ref name="description.content"/> + </element> + </define> + <define name="description.content"> + + <optional> + <ref name="AttrXMLLang"/> + </optional> + <text/> + </define> + <define name="image"> + <a:documentation>http://purl.org/net/rss1.1#image</a:documentation> + <element name="image"> + + <ref name="image.content"/> + </element> + </define> + <define name="image.content"> + <optional> + <ref name="AttrXMLLang"/> + </optional> + <ref name="AttrRDFResource"/> + <interleave> + + <ref name="title"/> + <optional> + <ref name="link"/> + </optional> + <ref name="url"/> + <zeroOrMore> + <ref name="Any"/> + </zeroOrMore> + </interleave> + + </define> + <define name="url"> + <a:documentation>http://purl.org/net/rss1.1#url</a:documentation> + <element name="url"> + <ref name="url.content"/> + </element> + </define> + <define name="url.content"> + + <data type="anyURI"/> + </define> + <define name="items"> + <a:documentation>http://purl.org/net/rss1.1#items</a:documentation> + <element name="items"> + <ref name="items.content"/> + </element> + </define> + + <define name="items.content"> + <optional> + <ref name="AttrXMLLang"/> + </optional> + <ref name="AttrRDFCollection"/> + <zeroOrMore> + <ref name="item"/> + </zeroOrMore> + </define> + + <define name="item"> + <a:documentation>http://purl.org/net/rss1.1#item</a:documentation> + <element name="item"> + <ref name="item.content"/> + </element> + </define> + <define name="item.content"> + <optional> + + <ref name="AttrXMLLang"/> + </optional> + <ref name="AttrRDFAbout"/> + <interleave> + <ref name="title"/> + <ref name="link"/> + <optional> + <ref name="description"/> + </optional> + + <optional> + <ref name="image"/> + </optional> + <zeroOrMore> + <ref name="Any"/> + </zeroOrMore> + </interleave> + </define> + <define name="Any"> + + <a:documentation>http://purl.org/net/rss1.1#Any</a:documentation> + <element> + <anyName> + <except> + <nsName/> + </except> + </anyName> + <ref name="Any.content"/> + + </element> + </define> + <define name="Any.content"> + <zeroOrMore> + <attribute> + <anyName> + <except> + <nsName/> + <nsName ns=""/> + + </except> + </anyName> + </attribute> + </zeroOrMore> + <mixed> + <zeroOrMore> + <ref name="Any"/> + </zeroOrMore> + </mixed> + + </define> + <define name="AttrXMLLang"> + <attribute name="xml:lang"> + <data type="language"/> + </attribute> + </define> + <define name="AttrXMLBase"> + <attribute name="xml:base"> + <data type="anyURI"/> + + </attribute> + </define> + <define name="AttrRDFAbout"> + <attribute name="rdf:about"> + <data type="anyURI"/> + </attribute> + </define> + <define name="AttrRDFResource"> + <attribute name="rdf:parseType"> + + <value>Resource</value> + </attribute> + </define> + <define name="AttrRDFCollection"> + <attribute name="rdf:parseType"> + <value>Collection</value> + </attribute> + </define> + +</grammar> |