这是我的XML:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE system SYSTEM "system.dtd">
<system>
<items>
<item id="1">item1</item>
</items>
<stores>
<store id="2">
<name>name1</name>
<type>normal</type>
<capacity>5</capacity>
</store>
</stores>
<area>
<slot id="4" name="name3" parallel="true">
<input id="3" name="name2">
<item></item>
</input>
<machine>
<cost></cost>
<time></time>
</machine>
</slot>
</area>
</system>
这是我的XML DTD:
<!ELEMENT system (items?,stores?,area*)>
<!ELEMENT items (item*)>
<!ELEMENT item (#PCDATA)>
<!ATTLIST item id ID #REQUIRED>
<!ELEMENT stores (store*)>
<!Element store (name,type,capacity)> // Error appears here
<!Element name (#PCDATA)>
<!Element type (#PCDATA)>
<!Element capacity (#PCDATA)>
<!ATTLIST store id ID #REQUIRED>
<!ELEMENT area (slot*)>
<!ELEMENT slot (input*,output*,(slot | ref | conveyor | generator | machine | turntable)*>
<!ELEMENT input (item+)>
<!ELEMENT output (item+)>
<!ELEMENT item (#PCDATA)>
<!ATTLIST input id ID #REQUIRED>
<!ATTLIST input name CDATA #IMPLIED>
<!ATTLIST output id ID #REQUIRED>
<!ATTLIST output name CDATA #IMPLIED>
<!ELEMENT ref (#PCDATA)>
<!ATTLIST ref id ID #IMPLIED>
<!ELEMENT conveyor (cost*,time*)>
<!ELEMENT generator (cost*,time*)>
<!ELEMENT machine (cost*,time*)>
<!ELEMENT turntable (cost*,time*)>
<!ELEMENT cost (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ATTLIST slot id ID #REQUIRED>
<!ATTLIST slot name CDATA #REQUIRED>
<!ATTLIST slot parallel CDATA #IMPLIED>
我做了验证,我收到了您在标题中可以看到的错误,我在代码中标记了它。我想它是一个简单的问题,但我找不到错误。
答案 0 :(得分:1)
它不是一个很好的诊断,是吗?
您的DTD中有两个错误:(a)ELEMENT
必须始终为大写,(b)缺少&#39;)&#39;在ELEMENT slot
的声明中。