This is the RELAX NG schema for the Paloose sitemaps. They are very similar to Cocoon sitemaps, but with enough differences to make it worth formalising separately. Any bug reports, help, suggestions, new task schemas etc to me, Hugh Field-Richards (hsfr@hsfr.org.uk).
The documentation is designed to be processed by the rng2xhtml.xsl pretty-printing processor available from the author.
<define name="components.actions"> <element name="map:actions"> <zeroOrMore> <ref name="actions.action"/> </zeroOrMore> </element> </define>
<define name="actions.action"> <sch:pattern name="Check the identities are unique within a category"> <sch:rule context="map:action"> <sch:assert test="count(//map:action[@name = current()/@name]) = 1">There should be unique action names</sch:assert> </sch:rule> </sch:pattern> <element name="map:action"> <attribute name="name"/> <attribute name="src"> <choice> <value>resource://lib/acting/SendMailAction</value> <value>resource://lib/acting/CookiesAction</value> <value>resource://lib/acting/AuthAction</value> <value>resource://lib/acting/LoginAction</value> <value>resource://lib/acting/LogoutAction</value> </choice> </attribute> <interleave> <optional> <ref name="SendMailAction.declaration"/> </optional> </interleave> </element> </define>
<define name="SendMailAction.declaration"> <interleave> <zeroOrMore> <ref name="SendMailAction.parameters"/> </zeroOrMore> </interleave> </define>
<define name="SendMailAction.parameters"> <sch:pattern name="smtp elements only allowed within SendMailAction"> <sch:rule context="//*[ local-name() = 'smtp-host' ]"> <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-host only allowed in SendMailAction</sch:report> </sch:rule> <sch:rule context="//*[ local-name() = 'smtp-user' ]"> <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-user only allowed in SendMailAction</sch:report> </sch:rule> <sch:rule context="//*[ local-name() = 'smtp-password' ]"> <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-password only allowed in SendMailAction</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="Only one of SendMailAction nested elements allowed of each type"> <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]"> <sch:report test="count( smtp-host ) > 1">Only 1 smtp-host element allowed here</sch:report> </sch:rule> <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]"> <sch:report test="count( smtp-user ) > 1">Only 1 smtp-user element allowed here</sch:report> </sch:rule> <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]"> <sch:report test="count( smtp-password ) > 1">Only 1 smtp-password element allowed here</sch:report> </sch:rule> </sch:pattern> <interleave> <element name="smtp-host"> <text/> </element> <element name="smtp-user"> <text/> </element> <element name="smtp-password"> <text/> </element> </interleave> </define>
<define name="action.instance"> <sch:pattern name="SendMailAction "> <sch:rule context="//map:act[@type = //map:actions/map:action[@src='resource://lib/acting/SendMailAction']/@name]"> <sch:report test="not( map:parameter[ @name = 'from' ] )">Missing "from" parameter in SendMailAction instance.</sch:report> <sch:report test="not( map:parameter[ @name = 'to' ] )">Missing "to" parameter in SendMailAction instance.</sch:report> <sch:report test="not( map:parameter[ @name = 'subject' ] )">Missing "subject" parameter in SendMailAction instance.</sch:report> <sch:report test="not( map:parameter[ @name = 'body' ] )">Missing "body" parameter in SendMailAction instance.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="AuthAction "> <sch:rule context="//map:act[@type = //map:actions/map:action[@src='resource://lib/acting/AuthAction']/@name]"> <sch:report test="not( map:parameter[ @name = 'handler' ] )">Missing "handler" parameter in AuthAction instance.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="LoginAction "> <sch:rule context="//map:act[@type = //map:actions/map:action[@src='resource://lib/acting/LoginAction']/@name]"> <sch:report test="not( map:parameter[ @name = 'handler' ] )">Missing "handler" parameter in LoginAction instance.</sch:report> <sch:report test="not( map:parameter[ @name = 'username' ] )">Missing "username" parameter in LoginAction instance.</sch:report> <sch:report test="not( map:parameter[ @name = 'password' ] )">Missing "password" parameter in LoginAction instance.</sch:report> </sch:rule> </sch:pattern> <sch:pattern name="LogoutAction "> <sch:rule context="//map:act[@type = //map:actions/map:action[@src='resource://lib/acting/LogoutAction']/@name]"> <sch:report test="not( map:parameter[ @name = 'handler' ] )">Missing "handler" parameter in LogoutAction instance.</sch:report> </sch:rule> </sch:pattern> <element name="map:act"> <attribute name="type"/> <zeroOrMore> <element name="map:parameter"> <attribute name="name"/> <attribute name="value"/> </element> </zeroOrMore> <ref name="pipeline.act"/> </element> </define>
<define name="pipeline.act"> <zeroOrMore> <choice> <ref name="aggregate.instance"/> <ref name="generator.instance"/> <ref name="transformer.instance"/> <ref name="serializer.instance"/> <ref name="reader.instance"/> <ref name="resource.mount"/> <ref name="selector.instance"/> <ref name="resource.call"/> <ref name="action.instance"/> <ref name="resource.redirect-to"/> </choice> </zeroOrMore> </define>
Copyright (c) 2006 – 2009 Hugh Field-Richards
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; either version 2 of the License, or (at your option) any later version.
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.
For a copy of the GNU General Public License write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.