ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <>
Subject RE: xml namespace support in ant2
Date Fri, 06 Sep 2002 10:20:19 GMT
> > Other than that you still have to decide on a schema 
> language to use.  I
> > would argue that RELAX NG would be the most suitable for 
> this kind of stuff.
> > But I'm not an expert on this, so maybe someone will disagree.
> For this, DTD is not usable, Schema is possible, but many agree that 
> RELAX NG is the best... if only I knew what it is ;-)

Take a look at the excellent RELAX NG Tutorial

Just to give you an idea, here is the (complete?) grammar I wrote for
<patternset> (using an XML namespace):

<grammar xmlns="" 

 <define name="patternset">
  <element name="ant:patternset">
   <ref name="default-attributes"/>
   <ref name="patternset-content"/>

 <define name="default-attributes">
  <optional><attribute name="id"/></optional>
  <optional><attribute name="description"/></optional>

 <define name="patternset-content" combine="choice">
  <attribute name="refid"/>

 <define name="patternset-content" combine="choice">
  <ref name="patternset-attributes"/>
  <ref name="patternset-elements"/>

 <define name="patternset-attributes">
  <optional><attribute name="includes"/></optional>
  <optional><attribute name="includesfile"/></optional>
  <optional><attribute name="excludes"/></optional>
  <optional><attribute name="excludesfile"/></optional>

 <define name="patternset-elements">
    <attribute name="name"/>
    <optional><attribute name="if"/></optional>
    <optional><attribute name="unless"/></optional>


Since RNG is very flexible you can write an equivalent grammar in many
different ways.  Just a matter of style and taste.

To play around with RELAX NG I suggest you download Sun's MSV



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message