just design ur xml first like you may want to store things like author etc
like
<document type="txt">
<metainfo>
<author>author name</author>
</metainfo>
<body>document body
</body>
</document>
use read your text/rtf/doc file and put the text in the document body. you may have to convert all the '<' and '>' to < and > and reconvert at the time of use, to avoid errors when xml parser will try to use/load the document.