CIT041X Index > Lecture 4 > Lecture 4 Example - Solution

Lecture 4 Example: Club Database RNG Specification

grammar {

start = element club-database
{
    element association
    {
        attribute id { text },
        club-defn +
    }
}

club-defn =
    element club
    {
        attribute id {text},
        element charter {text},
        element name {text},
        element location {text},
        (
            element contact-list
            {
                contact-defn +
            } |
            contact-defn
        ),
        element age-groups
        {
            attribute type {text}
        },
        element info { text } ?
    }

        
            
contact-defn =
    element contact
    {
        element person {text},
        element phone
        {
            text,
            attribute type { "home" | "work" | "fax" | "cell" }
        } +,
        element email {text} *
    }


} # end grammar