3

My current project consists of letters which are in collections. Each collection has an id and the letters refer to these ids. Coming from the "TEI world", I thought it would be the best solution to do that with #:

<collection xml:id="1"/>

<letter is_included_in="#1"/>

I thought that is the usal and best way to do that and also intended by the XPointer standard.

Recently, I have learned there is a dt:type="idref" type in XML Schema to handle references to ids. This way it would be without the #.

So, I'm a little bit confused right now.

What is best pratice here and a the most semantic way to handle id references inside one xml document? Or, in other words: How would any human or non-human reader which doesn't know my XMl schema expect me to do this?

Mehraban
  • 3,164
  • 4
  • 37
  • 60
cis
  • 1,259
  • 15
  • 48
  • Where are you getting the _#_ idea from? It's used in HTML anchor _href_ attributes because it represents the fragment part of a URL and instructs the browser to scroll to a certain element in the current page. In other contexts it may not make much sense. – McDowell Feb 28 '14 at 09:59
  • It is part of the TEI standard. In TEI all entities with IDs are allways refered with #. E.g. Behn, Aphra, refering to a element. – cis Mar 03 '14 at 06:43

1 Answers1

2

If you're developing a simple referencing scheme that does not have to make sub-references, I recommend that you do not pre-pend all references with hash characters (#):

<collection xml:id="c1"/>

<letter is_included_in="c1"/>
  • At the base level, standard practice is for identifier and reference to match exactly; @id and @idref match exactly.
  • Historically, # in a reference is used to precede a reference to a subpart. (See specifically the widely adopted standard use of hash marks in HTML @href to introduce a fragment identifier to refer to a named part of an HTML page.) TEI and XPointer built upon this convention in URIs.
  • The XML spec requires that attribute values of type ID must match the Name production, which prohibits id's from starting with a number.
kjhughes
  • 106,133
  • 27
  • 181
  • 240