In response to my comment, you indicated that this is the goal:
I want users to be able to select specific words in a poem and add annotations. I want to save each annotation as a tuple.
, . , . , .
Rangy
. , - . , DOM , , Rangy. , , , , . , , .
, . ( .)
Rangy Serializer Module
. , , , DOM.
, DOM, , . DOM , . ( .)
:
<poem><title>Galaxy</title>Twinkle Twinkle Little Star</poem>
, . - , , , . , , :
<poem><title>Galaxy</title><author>John Doe</author>Twinkle Twinkle Little Star</poem>
, .
, , , . :
rangy.serializeSelection(sel, false, root)
sel. false, , , DOM . root , .
, . , . , poem, . , poem.
, , , , :
<poem><title>Galaxy</title>Twinkle Twinkle <ann-start ann="#ANN.1"/>Little Star<ann-end ann="#ANN.1"/></poem>
<ann id="ANN.1" creator="Bob">In private correspondence, the author referred to his daughter as his "Little Star"</ann>
( XML . -.)
<ann-start> <ann-end> , , XML ( HTML) straddle. ann - , , ann-start ann-end.
, , . :
<poem><title>Galaxy</title><author>John Doe</author>Twinkle Twinkle <ann-start ann="#ANN.1"/>Little Star<ann-end ann="#ANN.1"/></poem>
<ann id="ANN.1" creator="Bob">In private correspondence, the author referred to his daughter as his "Little Star"</ann>
, .
, ?
. :
PAGETEXT: <poem><title>Galaxy</title>Twinkle Twinkle Little Star</poem>
3. SELECTION: Twinkle (the second one)
RELATIVETO: poem
RESULT: start = 28
28 , :
id, . , ( ), ( , ).