Search code examples
xmlxsddtdcycle

Survey: how are you using ID/IDREF? (or key/keyref)


I'm interested in how people use this feature: what domain, what relationships (apologies if survey questions aren't appropriate).

XML represents trees naturally using containment; but it can also represent graphs, using IDREFs that refer to IDs: many elements can refer to the same element (multi-ref); and a nested element can refer to an ancestor (cycle). It might also be convenient to use IDs and IDREFs so the XML structure matches another storage format, e.g. database foreign keys.

What do you represent with ID/IDREF?

EDIT Also including <key>/<keyref> from XML Schema.


Solution

  • I mostly use XML for publishing, not to store data, so I use ID/IDREFs for links and cross-references (where the content of the element with the IDREF will be pulled from the element with the ID).