Annotations in XML

Adobe Digital Editions has a nice way of storing annotations: they're kept in separate XML files from the source document, and use XPointer to denote where the annotations start and end in the text.

Here's an example (on OS X, they're stored in Documents > Digital Editions > Annotations):


<annotationSet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://ns.adobe.com/digitaleditions/annotations">
  <publication>
    <dc:title>The Adventures of Sherlock Holmes</dc:title>
    <dc:creator>Sir Conan Doyle</dc:creator>
    <dc:publisher>Gutenberg Foundation</dc:publisher>
    <dc:identifier>urn:uuid:c98702cc-1def-4789-9366-18d8bdf83710</dc:identifier>
  </publication>
  <annotation>
    <dc:identifier>urn:uuid:0D5057C3-3E62-3522-DBE7-82686EA094E4</dc:identifier>
    <dc:date>2008-01-16T11:42:37-08:00</dc:date>
    <target>
      <fragment start="chapter04.html#point(/1/4/4/14/1:3)" end="chapter04.html#point(/1/4/4/14/1:386)"/>
    </target>
    <content>
      <dc:date>2008-01-16T11:42:37-08:00</dc:date>
      <text>example of an annotation</text>
    </content>
  </annotation>
</annotationSet>

The 4/14/1:3 and 4/14/1:386 say that the annotation stretches from the 3rd to the 386th character of the 14th node (which is actually the 7th paragraph), I believe.

However, what if you want to store the annotations within the XML document itself? With the possibility of multiple overlapping annotations and alternatives for a certain section of text, this is the best I can think of at the moment:


<doc>
Boscombe Valley is a country district not very far from <annotation length="4" content="a town"/>Ross, in Herefordshire.
The largest landed proprietor in that part is a <annotation length="15" content="a person"/>Mr. John Turner, who made his money in <annotation length="9" "a country"/>Australia and returned some years ago to the old country.
</doc>

This uses a closed annotation element to mark the start of the annotation, and a length attribute to denote the end of the annotation. The content of the annotation is stored in an attribute, and other attributes can be added as necessary in the same way.

If anyone knows any other prior art, I'd appreciate it - it's hard to find.