Quackit Logo
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Create free Flash websites

DTD Attribute Types - IDREF

Print Version

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>

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
$1.99 .info domain names!
© Copyright 2000 - 2010 Quackit.com