CIS97 YT > Midterm Project 1 > Relax NG Projects > California USA Wrestling Club List Grammar

Relax NG Projects
California USA Wrestling Club List Grammar

Project Index | Documentation | Relax NG | Sample XML File

<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="club-database">
    <oneOrMore>
        <element name="association">
            <attribute name="id"/>
            <oneOrMore>
                <ref name="Club"/>
            </oneOrMore>
        </element>
    </oneOrMore>
</element>
</start>

<define name="Club">
<element name="club">
    <attribute name="id"> <text/> </attribute>
    <element name="charter"> <text /> </element>
    <element name="name"> <text /> </element>
    <element name="location"> <text /> </element>
    <choice>
        <element name="contact-list">
            <oneOrMore>
                <ref name="Contact"/>
            </oneOrMore>
        </element>
        <ref name="Contact"/>
    </choice>
    <element name="age-groups">
        <empty/>
        <attribute name="type"/>
    </element>
    <optional>
        <element name="info"> <text /> </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">fax</value>
                    <value type="string">cell</value>
                </choice>
            </attribute>
        </element>
    </oneOrMore>
    <zeroOrMore>
        <element name="email"> <text/> </element>
    </zeroOrMore>
</element>
</define>

</grammar>