views:

69

answers:

1

For my assignment I have been assigned the task of creating a DTD for representing a virtual-geocaching game.

I am having a problem representing the location which can be either gps or wifi or both but not more then one of each. How would i represent this? The closest I could think of is listed below.

<!ELEMENT location ((gps|wifi)+)>

The full DTD is here.

<!ELEMENT game (information, caches)>
    <!ELEMENT information (gameID, gameName, gameDescription, date, author)>
     <!ELEMENT gameID (#PCDATA)>
     <!ELEMENT gameName (#PCDATA)>
     <!ELEMENT gameDescription (#PCDATA)>
     <!ELEMENT date (#PCDATA)>
     <!ELEMENT author (#PCDATA)>
    <!ELEMENT caches (cache+)>
     <!ELEMENT cache (cacheID, cacheName, location, value)>
      <!ELEMENT cacheID (#PCDATA)>
      <!ELEMENT cacheName (#PCDATA)>
      <!ELEMENT location ((gps|wifi)+)>
       <!ELEMENT gps (longitude, latitude)>
        <!ELEMENT latitude (#PCDATA)>
        <!ELEMENT longitude (#PCDATA)>
       <!ELEMENT wifi (#PCDATA)>
      <!ELEMENT value (#PCDATA)>

Where each game contains some information about it and a number of caches.

Cheers in advance.

+1  A: 

Try this:

<!ELEMENT location ((gps|wifi|(gps,wifi)|(wifi,gps)))>
nickf
Worked perfectly! thanks =]
Malachi