perguntas DTD (um ou outro [ou ambos])
Pergunta
Para minha missão eu ter sido atribuída a tarefa de criar um DTD para representar um jogo virtual-geocaching.
Eu estou tendo um problema que representa o local que pode ser GPS ou Wi-Fi ou ambos, mas não mais do que um de cada. Como eu poderia representar este? O mais próximo que eu poderia pensar é listado abaixo.
<!ELEMENT location ((gps|wifi)+)>
A DTD completa está aqui.
<!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)>
Onde cada jogo contém algumas informações sobre ele e uma série de caches.
Cheers antecipadamente.
Solução
Tente isto:
<!ELEMENT location ((gps|wifi|(gps,wifi)|(wifi,gps)))>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow