Slected text

Hi,

How to store into a string of the getBeginIndex() and getEndIndex() into a string.? and after into xml file
Regards,
R.Denesh Kumar