DTD Attribute Types - IDREF
The attribute type of IDREF is used for referring to an ID value of another element in the document.
Syntax:
<!ATTLIST element_name
attribute_name IDREF default_value>
Example:
<!ATTLIST employee
employee_id ID #REQUIRED
manager_id IDREF #IMPLIED>
Valid XML - The following XML document would be valid, as it conforms to the above DTD:
<employees>
<employee employee_id="e10001" manager_id="e10002">
<first_name>Homer</first_name>
<last_name>Flinstone</last_name>
</employee>
<employee employee_id="e10002">
<first_name>Fred</first_name>
<last_name>Burns</last_name>
</employee>
</employees>
Invalid XML - The following XML document would be invalid. This is because the "manager_id" attribute of the second element contains a value that isn't the same as a value of another element that contains an attribute with a type of ID:
<employees>
<employee employee_id="e10001" manager_id="e10002>
<first_name>Homer</first_name>
<last_name>Flinstone</last_name>
</employee>
<employee employee_id="e10002" manager_id="e10003>
<first_name>Fred</first_name>
<last_name>Burns</last_name>
</employee>
</employees>

