xmlreferenceidentifierxpointer

XML referencing to an id with # or not?


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?


Solution

  • 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"/>