Relax NG
<grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="gradebook">
<ref name="taskDefinition"/>
<oneOrMore>
<element name="student">
<ref name="studentDefinition"/>
</element>
</oneOrMore>
</element>
</start>
<define name="taskDefinition">
<element name="task-list">
<zeroOrMore>
<element name="task">
<text />
<attribute name="id">
<data type="ID"/>
</attribute>
<attribute name="type">
<choice>
<value type="string">homework</value>
<value type="string">lab</value>
<value type="string">project</value>
<value type="string">attendance</value>
<value type="string">extra-credit</value>
<value type="string">test</value>
<value type="string">quiz</value>
<value type="string">midterm</value>
<value type="string">final</value>
</choice>
</attribute>
<attribute name="weight">
<data type="decimal"/>
</attribute>
<attribute name="max">
<data type="decimal"/>
</attribute>
<attribute name="date">
<data type="date"/>
</attribute>
<optional>
<attribute name="recorded">
<choice>
<value type="string">yes</value>
<value type="string">no</value>
</choice>
</attribute>
</optional>
</element>
</zeroOrMore>
</element>
</define>
<define name="studentDefinition">
<element name="last"><text/></element>
<element name="first"><text/></element>
<element name="email"><text/></element>
<element name="info"><text/></element>
<oneOrMore>
<element name="result">
<ref name="resultDefinition"/>
</element>
</oneOrMore>
<attribute name="id">
<data type="ID">
<param name="pattern">S[0-9-]{9,11}</param>
</data>
</attribute>
</define>
<define name="resultDefinition">
<text/>
<attribute name="ref">
<data type="IDREF"/>
</attribute>
<attribute name="score">
<choice>
<value type="string"></value>
<data type="positiveInteger">
<param name="maxInclusive">100</param>
</data>
</choice>
</attribute>
</define>
</grammar>