> > 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 (http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html). Just to give you an idea, here is the (complete?) grammar I wrote for <patternset> (using an XML namespace): <grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:ant="http://jakarta.apache.org/Ant/v2"> <define name="patternset"> <element name="ant:patternset"> <ref name="default-attributes"/> <ref name="patternset-content"/> </element> </define> <define name="default-attributes"> <optional><attribute name="id"/></optional> <optional><attribute name="description"/></optional> </define> <define name="patternset-content" combine="choice"> <attribute name="refid"/> </define> <define name="patternset-content" combine="choice"> <ref name="patternset-attributes"/> <ref name="patternset-elements"/> </define> <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> <define name="patternset-elements"> <zeroOrMore> <element> <choice> <name>ant:include</name> <name>ant:includesfile</name> <name>ant:exclude</name> <name>ant:excludesfile</name> </choice> <attribute name="name"/> <optional><attribute name="if"/></optional> <optional><attribute name="unless"/></optional> </element> </zeroOrMore> </define> </grammar> 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 (http://wwws.sun.com/software/xml/developers/multischema/). Cheers, -- knut
