[XML-SIG] A bit off topic: XML advice needed...

Matt Gushee Matt Gushee <matt@it.osha.sut.ac.jp>
Wed, 3 Mar 1999 19:08:22 +0900


Stuart Hungerford writes:

 > Anyways, suppose I have a DTD that describes elements for
 > dates, and in particular the <date> element. Now suppose I 
 > want to re-use my <date> element definition in a DTD for
 > marking up "events".  Each event has a start date and end
 > date.

I'm not much more than a beginner myself, but my off-the-cuff approach 
would be to make the start-date and end-date attributes of the
<event>, rather than elements. If there's a particular reason you need 
them to be elements, then maybe you could do something like

<!ELEMENT date ....
<!ATTLIST date
id ID #REQUIRED>

<!ELEMENT event ....
<!ATTLIST event
start IDREF #IMPLIED -- or #REQUIRED, if you prefer --
end IDREF #IMPLIED>

Afraid I can't really explain why I like this approach. Undoubtedly,
there are people with more expertise who will give you better answers.

Matt Gushee
Oshamanbe, Hokkaido, Japan