我不明白为什么 XML 文档中的这个 DTD 不会验证。它给我的错误是最后一行的“没有文档元素”。这很愚蠢,因为我可以删除除两行之外的所有代码,它仍然给我错误。我是 XML 的初学者,所以也许有更多经验的人来看看我?
<?xml version = "1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE events [
<!ELEMENT events (event)+>
<!ELEMENT event (itenerary, description, icon?, leader+, coordinator+, maxpart, registeredpart, carpool?, difficulty, cost?, destination)>
<!ELEMENT itenerary (startdate, enddate, departuretime, location)>
<!ELEMENT contact (name,phone+)>
<!ELEMENT name (firstname, lastname)>
<!ELEMENT startdate (year, month, day)>
<!ELEMENT enddate (year, month, day)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT day (#PCDATA)>
<!ELEMENT departuretime (hours,minutes)>
<!ELEMENT hours (#PCDATA)>
<!ELEMENT minutes (#PCDATA)>
<!ELEMENT location (street,city)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT icon (#PCDATA)>
<!ELEMENT leader (contact+)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT phone (landline?, cell?)>
<!ELEMENT coordinator (contact)>
<!ELEMENT landline (#PCDATA)>
<!ELEMENT cell (#PCDATA)>
<!ELEMENT maxpart (#PCDATA)>
<!ELEMENT registeredpart (#PCDATA)>
<!ELEMENT carpool (#PCDATA)>
<!ELEMENT difficulty (#PCDATA)>
<!ELEMENT cost (#PCDATA)>
<!ELEMENT destination (location)>
]>