我有以下.dtd文件

<!ELEMENT TVSCHEDULE (CHANNEL+)>
    <!ELEMENT CHANNEL (BANNER,DAY+)>
    <!ELEMENT BANNER (#PCDATA)>

    <!ELEMENT DAY (DATE,(HOLIDAY|PROGRAMSLOT+)+)>
    <!ELEMENT HOLIDAY (#PCDATA)>
    <!ELEMENT DATE (#PCDATA)>

    <!ELEMENT PROGRAMSLOT (TIME,TITLE,DESCRIPTION?)>
    <!ELEMENT TIME (#PCDATA)>
    <!ELEMENT TITLE (#PCDATA)>
    <!ELEMENT DESCRIPTION (#PCDATA)>

    <!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED>
    <!ATTLIST CHANNEL CHAN CDATA #REQUIRED>
    <!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED>
    <!ATTLIST TITLE RATING CDATA #IMPLIED>
    <!ATTLIST TITLE LANGUAGE CDATA #IMPLIED>


我不太明白这一行:

    <!ELEMENT DAY (DATE,(HOLIDAY|PROGRAMSLOT+)+)>


对于元素DAY,在以下语句中,它具有DATEEnumeration +(HOLIDAYPROGRAMSLOT+),哪个正确?

答:DAY元素仅包含DATE并且仅包含多个HOLIDAY

B. DAY元素仅包含DATE并且仅包含多个PROGRAMSLOT

C. DAY元素包含DATE以及多个HOLIDAYPROGRAMSLOT

我不明白为什么不能将其简化为

<!ELEMENT DAY (DATE,(HOLIDAY|PROGRAMSLOT)+)>


谢谢

最佳答案

我认为是C:
您必须在DAY之后加上一个序列,其中序列中的每个项目的类型均为HOLIDAY或PROGRAMSLOT序列

没有看到PROGRAMSLOT +的意义。用

<!ELEMENT DAY (DATE,(HOLIDAY|PROGRAMSLOT)+)>


您可以实现相同的灵活性。
我认为以下所有示例都是正确的:

DATE, HOLIDAY, HOLIDAY,HOLIDAY
DATE, PROGRAMSLOT, PROGRAMSLOT, PROGRAMSLOT
DATE, PROGRAMSLOT, HOLIDAY, HOLIDAY, PROGRAMSLOT
DATE, HOLIDAY, PROGRAMSLOT, HOLIDAY, PROGRAMSLOT


以下示例无效:

DATE, DATE // DATE can only occur once
DATE // the group of HOLIDAY OR PROGRAMLIST must occur at least once
HOLIDAY, DATE // DATE must be the first element

09-27 23:13