Using Converters in Stylus Studio

You can use converters to open any file as XML anywhere in Stylus Studio. For example, you might want to use a text file ( .txt) as the source document for XQuery Mapper. When you open a file using a converter, the adapter engine converts that file to XML on-the-fly, using the settings defined in the converter you select.

You can also use the Stylus Studio File System Java API to invoke an adapter programmatically to convert any file using the converter you specify. See Invoking an Adapter Programmatically for more information on this topic.

Types of Converters

In addition to the converters you create using the Convert to XML module ( .conv files), Stylus Studio comes bundled with numerous predefined converters to assist you in converting files to XML documents. They can be used to convert many common file formats, such as CSV, dBase, RTF, and Windows .ini files.

The process for using user-defined and built-in converters is essentially the same.

How to Open a File Using a Converter

Use the following procedure to open a file using a converter in Stylus Studio.

Tip

 

You can use the same basic procedure to save a file using a converter.

To open a file using a converter:
1. Display the Open dialog box (select File > Open from the Stylus Studio menu, for example).
2. Navigate to the directory that contains the file you want to open using the converter and select the file.
3. Check the Convert to XML using adapter check box and click the Open button.

Figure 182. Check Box to Open Files Using Converter

Stylus Studio displays the Select XML Converter dialog box.

Figure 183. Select XML Converter Dialog Box

4. If you are using a user-defined converter, expand the Convert to XML Definitions tree and select the converter you want to use to convert the file you selected in step 2 to XML and go to step 6.

Figure 184. Selecting a User-Defined Converter

If you are using a built-in converter, select the converter you want to use and go to step 5.

5. Specify the values you want to use for translation purposes. Many fields have a drop-down list that displays valid values, like the Line Separator property for the Comman-Separated Values converter shown here:

Figure 185. Built-In Converters Display Valid Properties

6. Click OK.

The file is converted to XML and appears in the editor from which you displayed the Open dialog box in step 1.

 
Free Stylus Studio XML Training: