给定这个 XML 文件的片段:
<Active>
<SystemName Permissions="RW" Datatype="STRING" Case="MIXED_RESPECT">NASCENT Default System Name</SystemName>
<ModelNumber Permissions="RO" Datatype="STRING" Case="MIXED_RESPECT">A104S2</ModelNumber>
<!-- snip snip snip -->
以及与之匹配的相应 DTD 片段:
<!ELEMENT Active (SystemName,ModelNumber,SerialNumber....)>
<!ELEMENT ModelNumber (#PCDATA)>
<!ATTLIST ModelNumber Permissions CDATA #FIXED "RO">
<!ATTLIST ModelNumber Datatype CDATA #FIXED "STRING">
<!ATTLIST ModelNumber Case CDATA #FIXED "MIXED_RESPECT">
<!ELEMENT SystemName (#PCDATA)>
<!ATTLIST SystemName Permissions (RW|RO) "RO"
Datatype CDATA #FIXED "STRING"
Case CDATA #FIXED "MIXED_RESPECT">
<!-- snip snip snip -->
针对 DTD 运行 XML 时出现以下错误:
/home/.../Active.xml:7: element ModelNumber: validity error : No declaration for attribute Permissions of element ModelNumber
<ModelNumber Permissions="RO" Datatype="STRING" Case="MIXED_RESPECT">A104S2</M
^
/home/.../Active.xml:7: element ModelNumber: validity error : No declaration for attribute Datatype of element ModelNumber
<ModelNumber Permissions="RO" Datatype="STRING" Case="MIXED_RESPECT">A104S2</M
^
/home/.../Active.xml:7: element ModelNumber: validity error : No declaration for attribute Case of element ModelNumber
<ModelNumber Permissions="RO" Datatype="STRING" Case="MIXED_RESPECT">A104S2</M
<!-- snip snip snip -->
有人可以解释它在抱怨什么吗?我看着谷歌,直到我睁一只眼闭一只眼。SystemName 有效,它识别 ModelNumber 等是它只能看到 !Attlist 的元素!