Reputation: 2241
Given this snippet of an XMLfile:
<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 -->
and a corresponding snippet of DTD that matches it:
<!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 -->
I get the following errors when running the XML against the DTD:
/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 -->
Can someone explain what it's whining about? I looked at Google till I'm cross eyed. The SystemName works, it recognizes that ModelNumber, etc are elements it just can see the !Attlist's!
Upvotes: 0
Views: 681
Reputation: 25034
Your analysis looks correct to me: your validator is not seeing the declarations for the ModelNumber attributes. The DTD fragment you show does have them, and the DTD and document instance are spelling everything the same way, and I am unable to replicate the problem on my system using the fragments you show.
One possible cause is that your validator is not reading the DTD you think it's reading. One way to test that is to introduce a syntax error, or suppress one of the attributes for SystemName, in the DTD you think is being used, and see if the error message changes.
Good luck.
Upvotes: 1