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="" xmlns:xhtml="" xmlns="">
    <dc:title>The Adventures of Sherlock Holmes</dc:title>
    <dc:creator>Sir Conan Doyle</dc:creator>
    <dc:publisher>Gutenberg Foundation</dc:publisher>
      <fragment start="chapter04.html#point(/1/4/4/14/1:3)" end="chapter04.html#point(/1/4/4/14/1:386)"/>
      <text>example of an annotation</text>

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:

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.

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.