Subject:Convert RTF to XML/XSLT Author:Minollo I. Date:13 Mar 2006 08:44 AM
You can convert a RTF document into an XML format using the Stylus Studio converters (when opening the RTF file, click the "Convert to XML" button in the Open File dialog, and then choose the RTF converter). If that doesn't work, some more details about what "doesn't work" means may help; also, attaching the RTF you are trying to convert would help too.
Subject:Convert RTF to XML/XSLT Author:hui see Date:13 Mar 2006 07:59 PM
Hi Millono,
Thanks for the prompt reply.
First I used WordPad to create a file with certain setting like bigger font and highlighted it with color. Saved it as a RTF file.
Then I did the way as you mentioned, which open the file using the Convert To XML. But there is no way for me to see the same setting as it supposed to have with this RTF file.
May I know what should I do in order to see the exact same format setting? Any configuration or setting need to be done?
Subject:Convert RTF to XML/XSLT Author:Minollo I. Date:13 Mar 2006 09:02 PM
The XML converters will translate the RTF format into an XML format, including the formatting information. But you shouldn't expect to see the formatting information rendered as the text *format*; you will see the formatting information returned as part of the XML information in which the RTF is encoded.
For example, if you try to write a few words in WordPad, save the result and open it specifying to convert it to XML and then choosing the RTF converter, you will get this XML document:
<rtf value="1">
<ansi/>
<ansicpg value="1252"/>
<deff value="0"/>
<deflang value="1033"/>
<fonttbl>
<f value="0">
<fswiss/>
<fcharset value="0"/>Arial;</f>
</fonttbl>
<generator ignorable="yes">Msftedit 5.41.15.1507;</generator>
<viewkind value="4"/>
<uc value="1"/>
<pard/>
<f value="0"/>
<fs value="20"/>I am a test!<par/></rtf>
Note the "I am a test" string a the bottom; that's what I types. Now, go back to WordPad, and make "test" bold; refresh the document in Stylus Studio and you will get this:
Note that the "test" block is now marked as being bold. Other formatting instructions will be formatted in a similar way.
The XML conversion of RTF preserves the formatting information; but the raw XML itself is not a presentation language; it won't "render" the formatting information as you would see it. But once the RTF is available as XML you can use it to carry one additional computation, or even to transform the document is some different presentational language (like HTML).