Hi all,
I'm sure this is a very basic XML question, but I can't find the answer anywhere. What is the most commonplace way of referring to a particular XML node at multiple other places inside the same XML document?
For example, consider a document like
<?xml version="1.0" encoding="ISO-8859-1"?>
<library>
<author id="john">
<name>John Brown</name>
</author>
<book>
<title>How To Peel Bananas In 10 Simple Steps</title>
<author ref="#john"/>
</book>
<book>
<title>Why Bananas Grow Upward</title>
<subtitle>How The Main World Religions View Banana Growth</subtitle>
<author ref="#john"/>
</book>
</library>
Clearly, the author node inside book nodes is intended to be a reference to the top-level author node. Ideally, when loading such a document into some OO programming language, the author attribute of a Book object would directly refer to the same Author object as the one that was created earlier on.
Clearly, my way of writing this down in XML is nonstandard and requires extra work after loading. Nevertheless, I'm sure people are storing cross-referenced stuff in XML all the time. What is the best and/or easiest and/or most "correct" feature to do something like this? What way is best supported by supporting standards, such as XPath and the likes?
I read about XLink but I'm not sure if it's the best solution - it also seems rather outdated and unused (is that true)?