CIS97 YT > Midterm Project 1 > Relax NG Projects > Rave Schedule Grammar

Relax NG Projects
California USA Wrestling Club List

Project Index | Documentation | Relax NG | Sample XML File

<grammar xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<start>
<element name="raves-database">
    <oneOrMore>
        <element name="production">
        <attribute name="id"/>
            <oneOrMore>
                    <ref name="Event"/>
            </oneOrMore>
            </element>
        </oneOrMore>
</element>
</start>

<define name="Event">
<element name="event">
    <attribute name="id">
    <data type="ID"/>
    </attribute>
    <element name="date"> 
    <data type="string">
        <param name="pattern">\d{2}-\d{2}-\d{4}</param>
    </data>
    </element>
    <element name="cost"> 
    <data type="decimal"/>
    </element>
    <element name="eventName"> <text /> </element>
    <choice>
        <element name="contact-info">
            <oneOrMore>
                <ref name="Contact"/>
            </oneOrMore>
        </element>
        <ref name="Contact"/>
    </choice>
    <element name="time"> <text /> </element>
    <element name="location"> <text /> </element>
    <element name="ages"> <text /> </element>
    <optional>
        <element name="info">
    <interleave> 
        <text />
        <zeroOrMore>
        <element name="rooms"><text/></element>
        </zeroOrMore>
        <zeroOrMore>
        <element name="featuring"><text/></element>
        </zeroOrMore>
        <zeroOrMore>
        <element name="website"><text/></element>
        </zeroOrMore>
    </interleave>
        </element>
    </optional>
</element>
</define>

<define name="Contact">
<element name="contact">
    <element name="person"> <text/> </element>
    <oneOrMore>
        <element name="phone">
            <text/>
            <attribute name="type">
                <choice>
                    <value type="string">home</value>
                    <value type="string">work</value>
                    <value type="string">cell</value>
                </choice>
            </attribute>
        </element>
    </oneOrMore>
    <zeroOrMore>
        <element name="email"> <text/> </element>
    </zeroOrMore>
</element>
</define>

</grammar>