According to the DTD specification on the ID attribute type:
Validity constraint: ID
Values of type ID MUST match the Name production. A name MUST NOT appear more than once in an XML document as a value of this type; i.e., ID values MUST uniquely identify the elements which bear them.
Which of the following explanations is correct?
- Values must differ among all instances of all attributes of type ID.
- Values must differ among all instances of the same attribute of type ID.
In other words, given the following DTD declaration snippet:
<!ELEMENT book ANY>
<!ATTLIST book id ID>
<!ELEMENT magazine ANY>
<!ATTLIST magazine id ID>
does the following XML document snippet violate the validity constraint?
<book id="ID01" />
<magazine id="ID01" />
How about if I renamed the attributes to book-id
and magazine-id
, instead of just id
in both cases?