In our application Html data is being rendered on webview of Android app. User can highlight the selected text. Selection could be a single word, across the paragraph or page. Service API are already exposed to save the highlighted data and below is the signature:
Highlight(paragraphId, startIndex, startHTML, endIndex,endHTML)
paragraphId: is the unique id of the paragraph where selection has been made.
startIndex : is the position of the word from where selection started.
startHTML : opening span tag.
endIndex : is the length of the selection.
endHTML : end of span tag.
We need these parameters value through highlight logic so that we could save the data in a predefined manner. There is a limitation to do highlight and save the data in this way only as there are two other components(iOS app & web browser app) which are in sync with this Android app and usually these other components fetch the data in this format with the same set of service API.