Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

DTD Attribute Types - IDREFS

Print Version

The attribute type of IDREFS is used for referring to the ID values of more than one other element in the document. Each value is separated by a space.

Syntax:

<!ATTLIST element_name
attribute_name IDREFS default_value>

Example:

<!ATTLIST individual
individual_id ID #REQUIRED
parent_id IDREFS #IMPLIED>

Valid XML - The following XML document would be valid, as it conforms to the above DTD:

<individuals>
  <individual individual_id="e10001" parent_id="e10002 e10003">
    <first_name>Bart</first_name>
    <last_name>Simpson</last_name>
  </individual>
  <individual individual_id="e10002">
    <first_name>Homer</first_name>
    <last_name>Simpson</last_name>
  </individual>
  <individual individual_id="e10003">
    <first_name>Marge</first_name>
    <last_name>Simpson</last_name>
  </individual>
</individuals>

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>

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!