元素类型"details"的内容必须匹配



我目前正在尝试使用验证我的XML文件https://www.xmlvalidation.com但我一直收到这个消息

16: 12  The content of element type "details" must match "(code+,title+,size+,price+,salePrice+,glazeType+,description+,image+)".

我的DTD是

<!ELEMENT catalog (details+)>
<!ELEMENT details (code+,title+,size+,price+,salePrice+,glazeType+,description+,image+)>
<!ELEMENT code (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT salePrice (#PCDATA)>
<!ELEMENT glazeType (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT image (#PCDATA)> 

和我的XML

<details>
<code>bcpot020</code>
<title>Copper Red Dish 001</title>
<size>50cm diameter</size>
<price>$450.00</price>
<glazeType>Copper Red</glazeType>
<description>Shallow Copper Red dish form showing distinctive qualities of this traditional reduction fired glaze. Fired to 1300 degrees</description>
<image>images/Copper Red Dish 001.jpg</image>
</details>
<details>
<code>bcpot003</code>
<title>Copper Red Bottle 001</title>
<size>60cm tall</size>
<price>$550.00</price>
<salePrice>$475.00</salePrice>
<glazeType>Copper Red</glazeType>
<description>Copper Red bottle form. Reduction fired to 1300 degrees</description>
<image>images/Copper Red Bottle 001.jpg</image>
</details>

关于如何修复此错误,有什么建议吗?

DTD需要一个或多个salePrice元素,但第一个details元素没有。

更改DTD使元素成为可选元素(例如,将"+"更改为"*"(,或者将salePrice元素添加到实例中。

相关内容

  • 没有找到相关文章

最新更新