鉴于以下DTD文件:
!ELEMENT hotels (address+)>
<!ELEMENT address (city,street,phone,hotelDetails)>
<!ELEMENT hotelDetails (hotel_code,hotel_rank,hotel_name)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT hotel_rank (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT hotel_code (#PCDATA)>
<!ELEMENT hotel_name (#PCDATA)>
<!ELEMENT guests (id+)>
<!ELEMENT guestDetails (name,city,address,state)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT state (#PCDATA)>
如您所见,我有两个不同的表:hotels
&amp; guests
,两个表格
有一列city
。当我尝试在XMLspy
中保存文件时,我得到:
Element 'city' has already been declared.
有没有办法为两个表声明该字段?
此致
罗恩
答案 0 :(得分:3)
您只需要此元素一次。它可以从address和guestDetails引用。