3

webviewを使用して、Androidプロジェクトの1つでepubリーダー用の「ハイライター」を作成しようとしています。選択したテキストを取得するためにRangyを使用しています。以下のサンプル HTML からテキストを選択すると、シリアル化関数によってこの値が得られます。

2/5/3/5/1/2:0,13/5/3/5/1/2:24

これをDBに保存しています。ユーザーがこのページに戻ると、同じ選択を取得して逆シリアル化しようとしていますが、逆シリアル化関数は次のエラーをスローします。

Error in Rangy Serializer module: deserializePosition failed: node <DIV>[7] has no child with index 13, 0

なぜこれが起こっているのですか?? XPathを使用して同じことをしようとしていますが、それでも同じ問題です。

<html>
<head>
<script></script>
</head>
<body>
<div id="mainpage" class="highlighter-context">
<div>       Some text here also....... </div>
<div>      Some text here also.........</div>
<div>
  <h1 class="heading"></h1>
  <div class="left_side">
<ol></ol>
<h1></h1>
<div class="text_bio">
In human beings, height, colour of eyes, complexion, chin, etc. are 
some recognisable features. A feature that can be recognised is known as 
character or trait. Human beings reproduce through sexual reproduction. In this                
process, two individuals one male and another female are involved. Male produces   
male gamete or sperm and female produces female gamete or ovum. These gametes fuse 
to form zygote which develops into a new young one which resembles to their parent. 
During the process of sexual reproduction 
</div>
  </div>
  <div class="righ_side">
  Some text here also.........
  </div>
  <div class="clr">
    Some text here also.......
  </div>
</div>
</div>
</body>
</html>

推測はありますか??

4

1 に答える 1