I have this question in a worksheet, but I've gotten it wrong about 5 times now, can someone please help?
Here is an XML DTD:
<!DOCTYPE meal [
<!ELEMENT meal (person*,food*,eats*)>
<!ELEMENT person EMPTY>
<!ELEMENT food EMPTY>
<!ELEMENT eats EMPTY>
<!ATTLIST person name ID #REQUIRED>
<!ATTLIST food name ID #REQUIRED>
<!ATTLIST eats diner IDREF #REQUIRED dish IDREF #REQUIRED>
]>
Which of the following documents match the DTD?
<meal>
<person name="Alice"/>
<food name="salad"/>
<eats diner="Alice" dish="salad"/>
<person name="Bob"/>
<food name="salad"/>
<eats diner="Bob" dish="salad"/>
<person name="Carol"/>
<food name="sandwich"/>
<eats diner="Carol" dish="sandwich"/>
</meal>
<meal>
<person name="Alice"/>
<person name="Bob"/>
<person name="Carol"/>
<person name="Dave"/>
<food name="salad"/>
<food name="turkey"/>
<food name="sandwich"/>
<eats diner="Alice" dish="turkey"/>
<eats diner="Bob" dish="salad"/>
<eats diner="turkey" dish="Dave"/>
</meal>
<meal>
<person name="Alice"/>
<person name="Bob"/>
<food name="salad"/>
<eats diner="Alice" dish="food"/>
<eats diner="Bob" dish="food"/>
</meal>
- Only the second
- Only the second and third
- Only the first and third
- Only the first
Thank you for your help
Only the second.
The first is invalid because
mealmust contain zero or morepersonfollowed by zero or morefoodfollowed by zero or moreeats.The third is invalid because there are no ID type attributes with the value
food. (dishis an attribute typeIDREF)