元素类型 "plant" 的内容必须匹配 (name,climate,height,usage,image)

The content of element type "plant" must match (name,climate,height,usage,image)

我正在为下面的 xml code.However 编写 DTD,输出是

元素类型"plant"的内容必须匹配(名称、气候、身高、用途、图片)

这是我的 xml 代码

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE catalog SYSTEM "plantdtd.dtd">

<catalog>

<title>Flowers of the week</title>

<plant id="A1">

     <name>Aloe vera</name>

     <climate>tropical</climate>

     <height>60-100cm</height>

     <usage>medicinal</usage>

     <image>aloevera.jpg</image>

 </plant>

 <plant id="A2">

      <name>Orchidaceae</name>

      <height>8-12in</height>

      <usage>medicinal</usage>

      <usage>decoration</usage>

      <image>Orchidaceae.jpg</image>

 </plant>

 </catalog>

这是我的 DTD。

<?xml encoding="UTF-8"?>
<!ELEMENT catalog (title,plant+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT plant (name,climate,height,usage,image)>
<!ATTLIST plant id CDATA  #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT climate (#PCDATA)>
<!ELEMENT height (#PCDATA)>
<!ELEMENT usage (#PCDATA)>
<!ELEMENT image (#PCDATA)>

请告诉我上面的 DTD 有什么问题。

假设实例文档为"right",DTD为"wrong",那么需要修改DTD,允许省略climate(写climate?)并允许要重复的用法(写 usage+)。这将使这两个示例 plant 元素有效,但当然要设计 DTD,您需要考虑所有可能的有效 plant 元素,而不仅仅是这两个。