You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jason van Zyl <jv...@zenplex.com> on 2002/03/28 13:33:16 UTC

Re: RELAX NG schema for project.xml (Re: [maven] project descriptor qns)

On Thu, 2002-03-28 at 07:15, Jeff Turner wrote:
> Attached is a RELAX NG schema that does the same.
> 
> Why? Just for the hell of it ;) And because RNG is very cool.. simple,
> powerful, readable.
> 
> http://www.oasis-open.org/committees/relax-ng/tutorial.html
> 
> There's also an Ant script to run it

There is also the multischema validation lib that does RELAX but I'm
still not sure of the license.I think an XML Schema is the way to go IMO
but I have never looked at relax-ng so I will take a peek now.

 
> 
> --Jeff
> 
> On Wed, Mar 27, 2002 at 06:57:12PM -0800, Daniel Rall wrote:
> > A DTD for the Maven project descriptor would answer a lot of these
> > questions.  What do you think?
> ----
> 

> #
> # RELAX NG schema for Maven's project descriptor (project.xml) format. Written
> # in RNG's non-XML syntax. To validate an XML, you'll need:
> #  Non-XML to XML syntax converter:
> #   http://www.thaiopensource.com/relaxng/nonxml/
> #  A RNG validator, like jing:
> #   http://www.thaiopensource.com/relaxng/jing.html
> #
> # Assuming the above, the commands to validate project.xml would be:
> #   export CLASSPATH=$CLASSPATH:rngnx.jar:jing.jar
> #   java com.thaiopensource.relaxng.nonxml.Driver project.rnx > project.rng
> #   java com.thaiopensource.relaxng.util.Driver project.rng project.xml
> #
> # Jeff Turner <je...@apache.org>
> #
> 
> datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
> 
> start =				project
> project =			element project {
> 						element name {text},
> 						element id {text},
> 						element currentVersion {text},
> 						element organization {text}?,
> 						element inceptionYear {
> 							xsd:gYear { pattern="[0-9]{4}" }
> 						},
> 						element package {
> 							xsd:string { pattern="[\S\.]+" }
> 						},
> 						element shortDescription {text},
> 						element gumpRepositoryId {text}?,
> 						element description {text}?,
> 						element url {xsd:anyURI},
> 						element cvsWebUrl {xsd:anyURI}?,
> 						element issueTrackingUrl {xsd:anyURI},
> 						element siteAddress {text}?,
> 						element siteDirectory {text}?,
> 						element distributionDirectory {text}?,
> 						distributions?,
> 						branches?,
> 						mailingLists,
> 						developers,
> 						dependencies,
> 						build
> 					}
> distributions =		element distributions {
> 						element distribution {
> 							element version {text},
> 							element tag {text}
> 						}*
> 					}
> 
> branches =			element branches {
> 						element branch {
> 							element tag {text}
> 						}*
> 					}
> mailingLists =		element mailingLists {
> 						element mailingList {
> 							element name {text},
> 							element subscribe {text},
> 							element unsubscribe {text},
> 							element archive {text}
> 						}*
> 					}
> developers =		element developers {
> 						element developer {
> 							element name {text},
> 							element id {text},
> 							element email {text},
> 							element organization {text}?
> 						}*
> 					}
> dependencies =		element dependencies {
> 						element dependency {
> 							element name {text},
> 							element type {"required"|"documentation"},
> 							element version {text},
> 							element jar {text},
> 							element url {xsd:anyURI}?
> 
> 						}*
> 					}
> build =				element build {
> 						sourceDirectories,
> 						testSourceDirectories?,
> 						aspectSourceDirectories?,
> 						unitTestClassEntries?,
> 						runtimeTestClassEntries?,
> 						integrationUnitTestClassEntries?,
> 						jarResources?,
> 						jars?
> 					}
> 
> sourceDirectories =			element sourceDirectories {
> 								element sourceDirectory {text}*
> 							}
> testSourceDirectories =		element testSourceDirectories {
> 								element testSourceDirectory {text}*
> 							}
> aspectSourceDirectories =	element aspectSourceDirectories {
> 								element aspectSourceDirectory {text}*
> 							}
> unitTestClassEntries =		element unitTestClassEntries {
> 								element unitTestClassEntry {text}*
> 							}
> runtimeTestClassEntries = 	element runtimeTestClassEntries {
> 								element runtimeTestClassEntry {text}*
> 							}
> integrationUnitTestClassEntries = element integrationUnitTestClassEntries {
> 									element integrationUnitTestClassEntry {text}*
> 								}
> jarResources =		element jarResources {
> 						element jarResource {text}*
> 					}
> jars =				element jars {
> 						element jar {text}*
> 					}
> ----
> 

> <?xml version="1.0"?>
> 
> <project name="validate" default="validate" basedir=".">
>     <property name="rnx" value="project.rnx"/>
>     <property name="rng" value="project.rng"/>
>     <property file="${user.home}/build.properties"/>
>     <property name="parser.jar" value="${lib.repo}/xerces.jar"/>
>     <property name="jing.jar" value="${lib.repo}/jing.jar"/>
>     <property name="rngnx.jar" value="${lib.repo}/rngnx.jar"/>
> 
>     <target name="rnx2rng">
>         <java 
>             classname="com.thaiopensource.relaxng.nonxml.Driver" 
>             fork="yes" 
>             failonerror="yes"
>             output="${rng}">
>             <arg line="${rnx}"/>
>             <classpath>
>                 <pathelement location="${rngnx.jar}"/>
>                 <pathelement location="${parser.jar}"/>
>             </classpath>
>         </java>
>     </target>
> 
>     <target name="validate" depends="rnx2rng">
> 
>         <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
>             <classpath>
>                 <pathelement location="${jing.jar}"/>
>                 <pathelement location="${parser.jar}"/>
>             </classpath>
>         </taskdef>
>         <jing rngfile="${rng}">
>             <fileset dir="." includes="project.xml"/>
>         </jing>
>     </target>
> </project>
> 
> ----
> 

> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: RELAX NG schema for project.xml (Re: [maven] project descriptor qns)

Posted by Jason van Zyl <jv...@zenplex.com>.
On Thu, 2002-03-28 at 18:46, Jeff Turner wrote:
> On Thu, Mar 28, 2002 at 07:33:16AM -0500, Jason van Zyl wrote:
> > On Thu, 2002-03-28 at 07:15, Jeff Turner wrote:
> > > Attached is a RELAX NG schema that does the same.
> > > 
> > > Why? Just for the hell of it ;) And because RNG is very cool.. simple,
> > > powerful, readable.
> > > 
> > > http://www.oasis-open.org/committees/relax-ng/tutorial.html
> > > 
> > > There's also an Ant script to run it
> > 
> > There is also the multischema validation lib that does RELAX but I'm
> > still not sure of the license.
> 
> The jing license looks compatible. But couldn't the choice of validator
> be optional, like the doc build system?

I'm really not into complete freedom when it comes to things like
validating the XML project model because it's critical. I would like to
pick the best solution and stick with it.
 
> > I think an XML Schema is the way to go IMO but I have never looked at
> > relax-ng so I will take a peek now.
> 
> It's neat :) You can whack out a schema in an evening, without the tool
> support that XSchema almost necessitates. As befitting something
> designed by James Clark, rather than by a committee after 2 years'
> wrangling.
> 
> --Jeff
> 
> > -- 
> > jvz.
> > 
> > Jason van Zyl
> > jvanzyl@apache.org
> > 
> > http://tambora.zenplex.org
> > 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: RELAX NG schema for project.xml (Re: [maven] project descriptor qns)

Posted by Jeff Turner <je...@socialchange.net.au>.
On Thu, Mar 28, 2002 at 07:33:16AM -0500, Jason van Zyl wrote:
> On Thu, 2002-03-28 at 07:15, Jeff Turner wrote:
> > Attached is a RELAX NG schema that does the same.
> > 
> > Why? Just for the hell of it ;) And because RNG is very cool.. simple,
> > powerful, readable.
> > 
> > http://www.oasis-open.org/committees/relax-ng/tutorial.html
> > 
> > There's also an Ant script to run it
> 
> There is also the multischema validation lib that does RELAX but I'm
> still not sure of the license.

The jing license looks compatible. But couldn't the choice of validator
be optional, like the doc build system?

> I think an XML Schema is the way to go IMO but I have never looked at
> relax-ng so I will take a peek now.

It's neat :) You can whack out a schema in an evening, without the tool
support that XSchema almost necessitates. As befitting something
designed by James Clark, rather than by a committee after 2 years'
wrangling.

--Jeff

> -- 
> jvz.
> 
> Jason van Zyl
> jvanzyl@apache.org
> 
> http://tambora.zenplex.org
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>