[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [cmis] Nikunj's blog postings on AtomPub vs CMIS
Al Brown wrote: > Can you send me the atom & app as rng xml notation if you have the tools > set up? > ... Sure. All attached, but not checked. BR, Julian
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- rnc -*-# RELAX NG Compact Syntax Grammar for the Atom Protocol --> <grammar xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <ref name="appService"/> </start> <!-- common:attrs --> <define name="atomURI"> <text/> </define> <define name="appCommonAttributes"> <optional> <attribute name="xml:base"> <ref name="atomURI"/> </attribute> </optional> <optional> <attribute name="xml:lang"> <ref name="atomLanguageTag"/> </attribute> </optional> <optional> <attribute name="xml:space"> <choice> <value>default</value> <value>preserved</value> </choice> </attribute> </optional> <zeroOrMore> <ref name="undefinedAttribute"/> </zeroOrMore> </define> <define name="atomCommonAttributes"> <ref name="appCommonAttributes"/> </define> <define name="undefinedAttribute"> <attribute> <anyName> <except> <name>xml:base</name> <name>xml:space</name> <name>xml:lang</name> <nsName ns=""/> </except> </anyName> </attribute> </define> <define name="atomLanguageTag"> <data type="string"> <param name="pattern">([A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*)?</param> </data> </define> <define name="atomDateConstruct"> <ref name="appCommonAttributes"/> <data type="dateTime"/> </define> <!-- app:service --> <define name="appService"> <element name="app:service"> <ref name="appCommonAttributes"/> <interleave> <oneOrMore> <ref name="appWorkspace"/> </oneOrMore> <zeroOrMore> <ref name="extensionElement"/> </zeroOrMore> </interleave> </element> </define> <!-- app:workspace --> <define name="appWorkspace"> <element name="app:workspace"> <ref name="appCommonAttributes"/> <interleave> <ref name="atomTitle"/> <zeroOrMore> <ref name="appCollection"/> </zeroOrMore> <zeroOrMore> <ref name="extensionSansTitleElement"/> </zeroOrMore> </interleave> </element> </define> <define name="atomTitle"> <element name="atom:title"> <ref name="atomTextConstruct"/> </element> </define> <!-- app:collection --> <define name="appCollection"> <element name="app:collection"> <ref name="appCommonAttributes"/> <attribute name="href"> <ref name="atomURI"/> </attribute> <interleave> <ref name="atomTitle"/> <zeroOrMore> <ref name="appAccept"/> </zeroOrMore> <zeroOrMore> <ref name="appCategories"/> </zeroOrMore> <zeroOrMore> <ref name="extensionSansTitleElement"/> </zeroOrMore> </interleave> </element> </define> <!-- app:categories --> <define name="atomCategory"> <element name="atom:category"> <ref name="atomCommonAttributes"/> <attribute name="term"/> <optional> <attribute name="scheme"> <ref name="atomURI"/> </attribute> </optional> <optional> <attribute name="label"/> </optional> <ref name="undefinedContent"/> </element> </define> <define name="appInlineCategories"> <element name="app:categories"> <optional> <attribute name="fixed"> <choice> <value>yes</value> <value>no</value> </choice> </attribute> </optional> <optional> <attribute name="scheme"> <ref name="atomURI"/> </attribute> </optional> <group> <zeroOrMore> <ref name="atomCategory"/> </zeroOrMore> <ref name="undefinedContent"/> </group> </element> </define> <define name="appOutOfLineCategories"> <element name="app:categories"> <attribute name="href"> <ref name="atomURI"/> </attribute> <ref name="undefinedContent"/> </element> </define> <define name="appCategories"> <choice> <ref name="appInlineCategories"/> <ref name="appOutOfLineCategories"/> </choice> </define> <!-- app:accept --> <define name="appAccept"> <element name="app:accept"> <ref name="appCommonAttributes"/> <optional> <text/> </optional> </element> </define> <!-- Simple Extension --> <define name="simpleSansTitleExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2007/app"/> <name>atom:title</name> </except> </anyName> <text/> </element> </define> <define name="simpleExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2007/app"/> </except> </anyName> <text/> </element> </define> <!-- Structured Extension --> <define name="structuredSansTitleExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2007/app"/> <name>atom:title</name> </except> </anyName> <choice> <group> <oneOrMore> <attribute> <anyName/> </attribute> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> <group> <zeroOrMore> <attribute> <anyName/> </attribute> </zeroOrMore> <group> <optional> <text/> </optional> <oneOrMore> <ref name="anyElement"/> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> </group> </choice> </element> </define> <define name="structuredExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2007/app"/> </except> </anyName> <choice> <group> <oneOrMore> <attribute> <anyName/> </attribute> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> <group> <zeroOrMore> <attribute> <anyName/> </attribute> </zeroOrMore> <group> <optional> <text/> </optional> <oneOrMore> <ref name="anyElement"/> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> </group> </choice> </element> </define> <!-- Other Extensibility --> <define name="extensionSansTitleElement"> <choice> <ref name="simpleSansTitleExtensionElement"/> <ref name="structuredSansTitleExtensionElement"/> </choice> </define> <define name="extensionElement"> <choice> <ref name="simpleExtensionElement"/> <ref name="structuredExtensionElement"/> </choice> </define> <define name="undefinedContent"> <zeroOrMore> <choice> <text/> <ref name="anyForeignElement"/> </choice> </zeroOrMore> </define> <!-- Extensions --> <define name="anyElement"> <element> <anyName/> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <define name="anyForeignElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2007/app"/> </except> </anyName> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <define name="atomPlainTextConstruct"> <ref name="atomCommonAttributes"/> <optional> <attribute name="type"> <choice> <value>text</value> <value>html</value> </choice> </attribute> </optional> <text/> </define> <define name="atomXHTMLTextConstruct"> <ref name="atomCommonAttributes"/> <attribute name="type"> <value>xhtml</value> </attribute> <ref name="xhtmlDiv"/> </define> <define name="atomTextConstruct"> <choice> <ref name="atomPlainTextConstruct"/> <ref name="atomXHTMLTextConstruct"/> </choice> </define> <define name="anyXHTML"> <element> <nsName ns="http://www.w3.org/1999/xhtml"/> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyXHTML"/> </choice> </zeroOrMore> </element> </define> <define name="xhtmlDiv"> <element name="xhtml:div"> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyXHTML"/> </choice> </zeroOrMore> </element> </define> </grammar> <!-- EOF -->
# -*- rnc -*-# RELAX NG Compact Syntax Grammar for the Atom Protocol namespace app = "http://www.w3.org/2007/app" namespace atom = "http://www.w3.org/2005/Atom" namespace xsd = "http://www.w3.org/2001/XMLSchema" namespace local = "" start = appCategories atomCommonAttributes = attribute xml:base { atomURI }?, attribute xml:lang { atomLanguageTag }?, undefinedAttribute* undefinedAttribute = attribute * - (xml:base | xml:lang | local:*) { text } atomURI = text atomLanguageTag = xsd:string { pattern = "([A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*)?" } atomCategory = element atom:category { atomCommonAttributes, attribute term { text }, attribute scheme { atomURI }?, attribute label { text }?, undefinedContent } appInlineCategories = element app:categories { attribute fixed { "yes" | "no" }?, attribute scheme { atomURI }?, (atomCategory*, undefinedContent) } appOutOfLineCategories = element app:categories { attribute href { atomURI }, (empty) } appCategories = appInlineCategories | appOutOfLineCategories # Extensibility undefinedContent = (text|anyForeignElement)* anyElement = element * { (attribute * { text } | text | anyElement)* } anyForeignElement = element * - atom:* { (attribute * { text } | text | anyElement)* } # EOF
# -*- rnc -*-# RELAX NG Compact Syntax Grammar for the Atom Protocol namespace app = "http://www.w3.org/2007/app" namespace atom = "http://www.w3.org/2005/Atom" namespace xsd = "http://www.w3.org/2001/XMLSchema" namespace xhtml = "http://www.w3.org/1999/xhtml" namespace local = "" start = appService # common:attrs atomURI = text appCommonAttributes = attribute xml:base { atomURI }?, attribute xml:lang { atomLanguageTag }?, attribute xml:space {"default"|"preserved"}?, undefinedAttribute* atomCommonAttributes = appCommonAttributes undefinedAttribute = attribute * - (xml:base | xml:space | xml:lang | local:*) { text } atomLanguageTag = xsd:string { pattern = "([A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*)?" } atomDateConstruct = appCommonAttributes, xsd:dateTime # app:service appService = element app:service { appCommonAttributes, ( appWorkspace+ & extensionElement* ) } # app:workspace appWorkspace = element app:workspace { appCommonAttributes, ( atomTitle & appCollection* & extensionSansTitleElement* ) } atomTitle = element atom:title { atomTextConstruct } # app:collection appCollection = element app:collection { appCommonAttributes, attribute href { atomURI }, ( atomTitle & appAccept* & appCategories* & extensionSansTitleElement* ) } # app:categories atomCategory = element atom:category { atomCommonAttributes, attribute term { text }, attribute scheme { atomURI }?, attribute label { text }?, undefinedContent } appInlineCategories = element app:categories { attribute fixed { "yes" | "no" }?, attribute scheme { atomURI }?, (atomCategory*, undefinedContent) } appOutOfLineCategories = element app:categories { attribute href { atomURI }, undefinedContent } appCategories = appInlineCategories | appOutOfLineCategories # app:accept appAccept = element app:accept { appCommonAttributes, ( text? ) } # Simple Extension simpleSansTitleExtensionElement = element * - (app:*|atom:title) { text } simpleExtensionElement = element * - (app:*) { text } # Structured Extension structuredSansTitleExtensionElement = element * - (app:*|atom:title) { (attribute * { text }+, (text|anyElement)*) | (attribute * { text }*, (text?, anyElement+, (text|anyElement)*)) } structuredExtensionElement = element * - (app:*) { (attribute * { text }+, (text|anyElement)*) | (attribute * { text }*, (text?, anyElement+, (text|anyElement)*)) } # Other Extensibility extensionSansTitleElement = simpleSansTitleExtensionElement|structuredSansTitleExtensionElement extensionElement = simpleExtensionElement | structuredExtensionElement undefinedContent = (text|anyForeignElement)* # Extensions anyElement = element * { (attribute * { text } | text | anyElement)* } anyForeignElement = element * - app:* { (attribute * { text } | text | anyElement)* } atomPlainTextConstruct = atomCommonAttributes, attribute type { "text" | "html" }?, text atomXHTMLTextConstruct = atomCommonAttributes, attribute type { "xhtml" }, xhtmlDiv atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct anyXHTML = element xhtml:* { (attribute * { text } | text | anyXHTML)* } xhtmlDiv = element xhtml:div { (attribute * { text } | text | anyXHTML)* } # EOF
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- rnc -*- RELAX NG Compact Syntax Grammar for the Atom Format Specification Version 11 --> <grammar xmlns:atom="http://www.w3.org/2005/Atom" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <choice> <ref name="atomFeed"/> <ref name="atomEntry"/> </choice> </start> <!-- Common attributes --> <define name="atomCommonAttributes"> <optional> <attribute name="xml:base"> <ref name="atomUri"/> </attribute> </optional> <optional> <attribute name="xml:lang"> <ref name="atomLanguageTag"/> </attribute> </optional> <zeroOrMore> <ref name="undefinedAttribute"/> </zeroOrMore> </define> <!-- Text Constructs --> <define name="atomPlainTextConstruct"> <ref name="atomCommonAttributes"/> <optional> <attribute name="type"> <choice> <value>text</value> <value>html</value> </choice> </attribute> </optional> <text/> </define> <define name="atomXHTMLTextConstruct"> <ref name="atomCommonAttributes"/> <attribute name="type"> <value>xhtml</value> </attribute> <ref name="xhtmlDiv"/> </define> <define name="atomTextConstruct"> <choice> <ref name="atomPlainTextConstruct"/> <ref name="atomXHTMLTextConstruct"/> </choice> </define> <!-- Person Construct --> <define name="atomPersonConstruct"> <ref name="atomCommonAttributes"/> <interleave> <element name="atom:name"> <text/> </element> <optional> <element name="atom:uri"> <ref name="atomUri"/> </element> </optional> <optional> <element name="atom:email"> <ref name="atomEmailAddress"/> </element> </optional> <zeroOrMore> <ref name="extensionElement"/> </zeroOrMore> </interleave> </define> <!-- Date Construct --> <define name="atomDateConstruct"> <ref name="atomCommonAttributes"/> <data type="dateTime"/> </define> <!-- atom:feed --> <define name="atomFeed"> <element name="atom:feed"> <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.</s:assert> </s:rule> <ref name="atomCommonAttributes"/> <interleave> <zeroOrMore> <ref name="atomAuthor"/> </zeroOrMore> <zeroOrMore> <ref name="atomCategory"/> </zeroOrMore> <zeroOrMore> <ref name="atomContributor"/> </zeroOrMore> <optional> <ref name="atomGenerator"/> </optional> <optional> <ref name="atomIcon"/> </optional> <ref name="atomId"/> <zeroOrMore> <ref name="atomLink"/> </zeroOrMore> <optional> <ref name="atomLogo"/> </optional> <optional> <ref name="atomRights"/> </optional> <optional> <ref name="atomSubtitle"/> </optional> <ref name="atomTitle"/> <ref name="atomUpdated"/> <zeroOrMore> <ref name="extensionElement"/> </zeroOrMore> </interleave> <zeroOrMore> <ref name="atomEntry"/> </zeroOrMore> </element> </define> <!-- atom:entry --> <define name="atomEntry"> <element name="atom:entry"> <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:assert> </s:rule> <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.</s:assert> </s:rule> <ref name="atomCommonAttributes"/> <interleave> <zeroOrMore> <ref name="atomAuthor"/> </zeroOrMore> <zeroOrMore> <ref name="atomCategory"/> </zeroOrMore> <optional> <ref name="atomContent"/> </optional> <zeroOrMore> <ref name="atomContributor"/> </zeroOrMore> <ref name="atomId"/> <zeroOrMore> <ref name="atomLink"/> </zeroOrMore> <optional> <ref name="atomPublished"/> </optional> <optional> <ref name="atomRights"/> </optional> <optional> <ref name="atomSource"/> </optional> <optional> <ref name="atomSummary"/> </optional> <ref name="atomTitle"/> <ref name="atomUpdated"/> <zeroOrMore> <ref name="extensionElement"/> </zeroOrMore> </interleave> </element> </define> <!-- atom:content --> <define name="atomInlineTextContent"> <element name="atom:content"> <ref name="atomCommonAttributes"/> <optional> <attribute name="type"> <choice> <value>text</value> <value>html</value> </choice> </attribute> </optional> <zeroOrMore> <text/> </zeroOrMore> </element> </define> <define name="atomInlineXHTMLContent"> <element name="atom:content"> <ref name="atomCommonAttributes"/> <attribute name="type"> <value>xhtml</value> </attribute> <ref name="xhtmlDiv"/> </element> </define> <define name="atomInlineOtherContent"> <element name="atom:content"> <ref name="atomCommonAttributes"/> <optional> <attribute name="type"> <ref name="atomMediaType"/> </attribute> </optional> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <define name="atomOutOfLineContent"> <element name="atom:content"> <ref name="atomCommonAttributes"/> <optional> <attribute name="type"> <ref name="atomMediaType"/> </attribute> </optional> <attribute name="src"> <ref name="atomUri"/> </attribute> <empty/> </element> </define> <define name="atomContent"> <choice> <ref name="atomInlineTextContent"/> <ref name="atomInlineXHTMLContent"/> <ref name="atomInlineOtherContent"/> <ref name="atomOutOfLineContent"/> </choice> </define> <!-- atom:author --> <define name="atomAuthor"> <element name="atom:author"> <ref name="atomPersonConstruct"/> </element> </define> <!-- atom:category --> <define name="atomCategory"> <element name="atom:category"> <ref name="atomCommonAttributes"/> <attribute name="term"/> <optional> <attribute name="scheme"> <ref name="atomUri"/> </attribute> </optional> <optional> <attribute name="label"/> </optional> <ref name="undefinedContent"/> </element> </define> <!-- atom:contributor --> <define name="atomContributor"> <element name="atom:contributor"> <ref name="atomPersonConstruct"/> </element> </define> <!-- atom:generator --> <define name="atomGenerator"> <element name="atom:generator"> <ref name="atomCommonAttributes"/> <optional> <attribute name="uri"> <ref name="atomUri"/> </attribute> </optional> <optional> <attribute name="version"/> </optional> <text/> </element> </define> <!-- atom:icon --> <define name="atomIcon"> <element name="atom:icon"> <ref name="atomCommonAttributes"/> <ref name="atomUri"/> </element> </define> <!-- atom:id --> <define name="atomId"> <element name="atom:id"> <ref name="atomCommonAttributes"/> <ref name="atomUri"/> </element> </define> <!-- atom:logo --> <define name="atomLogo"> <element name="atom:logo"> <ref name="atomCommonAttributes"/> <ref name="atomUri"/> </element> </define> <!-- atom:link --> <define name="atomLink"> <element name="atom:link"> <ref name="atomCommonAttributes"/> <attribute name="href"> <ref name="atomUri"/> </attribute> <optional> <attribute name="rel"> <choice> <ref name="atomNCName"/> <ref name="atomUri"/> </choice> </attribute> </optional> <optional> <attribute name="type"> <ref name="atomMediaType"/> </attribute> </optional> <optional> <attribute name="hreflang"> <ref name="atomLanguageTag"/> </attribute> </optional> <optional> <attribute name="title"/> </optional> <optional> <attribute name="length"/> </optional> <ref name="undefinedContent"/> </element> </define> <!-- atom:published --> <define name="atomPublished"> <element name="atom:published"> <ref name="atomDateConstruct"/> </element> </define> <!-- atom:rights --> <define name="atomRights"> <element name="atom:rights"> <ref name="atomTextConstruct"/> </element> </define> <!-- atom:source --> <define name="atomSource"> <element name="atom:source"> <ref name="atomCommonAttributes"/> <interleave> <zeroOrMore> <ref name="atomAuthor"/> </zeroOrMore> <zeroOrMore> <ref name="atomCategory"/> </zeroOrMore> <zeroOrMore> <ref name="atomContributor"/> </zeroOrMore> <optional> <ref name="atomGenerator"/> </optional> <optional> <ref name="atomIcon"/> </optional> <optional> <ref name="atomId"/> </optional> <zeroOrMore> <ref name="atomLink"/> </zeroOrMore> <optional> <ref name="atomLogo"/> </optional> <optional> <ref name="atomRights"/> </optional> <optional> <ref name="atomSubtitle"/> </optional> <optional> <ref name="atomTitle"/> </optional> <optional> <ref name="atomUpdated"/> </optional> <zeroOrMore> <ref name="extensionElement"/> </zeroOrMore> </interleave> </element> </define> <!-- atom:subtitle --> <define name="atomSubtitle"> <element name="atom:subtitle"> <ref name="atomTextConstruct"/> </element> </define> <!-- atom:summary --> <define name="atomSummary"> <element name="atom:summary"> <ref name="atomTextConstruct"/> </element> </define> <!-- atom:title --> <define name="atomTitle"> <element name="atom:title"> <ref name="atomTextConstruct"/> </element> </define> <!-- atom:updated --> <define name="atomUpdated"> <element name="atom:updated"> <ref name="atomDateConstruct"/> </element> </define> <!-- Low-level simple types --> <define name="atomNCName"> <data type="string"> <param name="minLength">1</param> <param name="pattern">[^:]*</param> </data> </define> <!-- Whatever a media type is, it contains at least one slash --> <define name="atomMediaType"> <data type="string"> <param name="pattern">.+/.+</param> </data> </define> <!-- As defined in RFC 3066 --> <define name="atomLanguageTag"> <data type="string"> <param name="pattern">[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*</param> </data> </define> <!-- Unconstrained; it's not entirely clear how IRI fit into xsd:anyURI so let's not try to constrain it here --> <define name="atomUri"> <text/> </define> <!-- Whatever an email address is, it contains at least one @ --> <define name="atomEmailAddress"> <data type="string"> <param name="pattern">.+@.+</param> </data> </define> <!-- Simple Extension --> <define name="simpleExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2005/Atom"/> </except> </anyName> <text/> </element> </define> <!-- Structured Extension --> <define name="structuredExtensionElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2005/Atom"/> </except> </anyName> <choice> <group> <oneOrMore> <attribute> <anyName/> </attribute> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> <group> <zeroOrMore> <attribute> <anyName/> </attribute> </zeroOrMore> <group> <optional> <text/> </optional> <oneOrMore> <ref name="anyElement"/> </oneOrMore> <zeroOrMore> <choice> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </group> </group> </choice> </element> </define> <!-- Other Extensibility --> <define name="extensionElement"> <choice> <ref name="simpleExtensionElement"/> <ref name="structuredExtensionElement"/> </choice> </define> <define name="undefinedAttribute"> <attribute> <anyName> <except> <name>xml:base</name> <name>xml:lang</name> <nsName ns=""/> </except> </anyName> </attribute> </define> <define name="undefinedContent"> <zeroOrMore> <choice> <text/> <ref name="anyForeignElement"/> </choice> </zeroOrMore> </define> <define name="anyElement"> <element> <anyName/> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <define name="anyForeignElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2005/Atom"/> </except> </anyName> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <!-- XHTML --> <define name="anyXHTML"> <element> <nsName ns="http://www.w3.org/1999/xhtml"/> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyXHTML"/> </choice> </zeroOrMore> </element> </define> <define name="xhtmlDiv"> <element name="xhtml:div"> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyXHTML"/> </choice> </zeroOrMore> </element> </define> </grammar> <!-- EOF -->
# -*- 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
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- rnc -*-# RELAX NG Compact Syntax Grammar for the Atom Protocol --> <grammar xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <ref name="appCategories"/> </start> <define name="atomCommonAttributes"> <optional> <attribute name="xml:base"> <ref name="atomURI"/> </attribute> </optional> <optional> <attribute name="xml:lang"> <ref name="atomLanguageTag"/> </attribute> </optional> <zeroOrMore> <ref name="undefinedAttribute"/> </zeroOrMore> </define> <define name="undefinedAttribute"> <attribute> <anyName> <except> <name>xml:base</name> <name>xml:lang</name> <nsName ns=""/> </except> </anyName> </attribute> </define> <define name="atomURI"> <text/> </define> <define name="atomLanguageTag"> <data type="string"> <param name="pattern">([A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*)?</param> </data> </define> <define name="atomCategory"> <element name="atom:category"> <ref name="atomCommonAttributes"/> <attribute name="term"/> <optional> <attribute name="scheme"> <ref name="atomURI"/> </attribute> </optional> <optional> <attribute name="label"/> </optional> <ref name="undefinedContent"/> </element> </define> <define name="appInlineCategories"> <element name="app:categories"> <optional> <attribute name="fixed"> <choice> <value>yes</value> <value>no</value> </choice> </attribute> </optional> <optional> <attribute name="scheme"> <ref name="atomURI"/> </attribute> </optional> <group> <zeroOrMore> <ref name="atomCategory"/> </zeroOrMore> <ref name="undefinedContent"/> </group> </element> </define> <define name="appOutOfLineCategories"> <element name="app:categories"> <attribute name="href"> <ref name="atomURI"/> </attribute> <empty/> </element> </define> <define name="appCategories"> <choice> <ref name="appInlineCategories"/> <ref name="appOutOfLineCategories"/> </choice> </define> <!-- Extensibility --> <define name="undefinedContent"> <zeroOrMore> <choice> <text/> <ref name="anyForeignElement"/> </choice> </zeroOrMore> </define> <define name="anyElement"> <element> <anyName/> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> <define name="anyForeignElement"> <element> <anyName> <except> <nsName ns="http://www.w3.org/2005/Atom"/> </except> </anyName> <zeroOrMore> <choice> <attribute> <anyName/> </attribute> <text/> <ref name="anyElement"/> </choice> </zeroOrMore> </element> </define> </grammar> <!-- EOF -->
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]