Overview

Stylus Studio's Convert to XML module is an adapter you use to build converters that convert non-XML files to XML documents. Convert to XML consists of

  • An adapter engine that processes non-XML source files using the converter configuration file ( .conv) you specify. The adapter engine is called silently any time you open a file using a Convert to XML converter. You can also run the adapter engine manually to test the results of the converters you create, but it has no user-visible or configurable components.
  • An editor that lets you configure the instructions in the .conv file used by the adapter engine to convert non-XML files to XML. The Convert to XML Editor, shown in Figure 148, displays information read from the input file you are using as a model to build your converter, as well as values you want the adapter engine to use when converting other files of this type to XML. The Convert to XML Editor is displayed automatically when you create a new converter or open an existing one.

Figure 148. Convert to XML Editor

File Support

Stylus Studio's Convert to XML makes it easy to build converters for many non-XML file types, including text, binary, and EDI. You can let Stylus Studio use a set of rules to determine the type, encoding, layout of the input file, or you can specify these settings manually, as shown in Figure 149.

Stylus Studio's heuristics are also used to determine the field separator character being used (if any), the delimiting character being used (if any), and so on.

Using Convert to XML

Generally speaking, you use Convert to XML to create a converter, and then you use that converter to convert one or more non-XML files to XML. The process of using Convert to XML involves the following steps:

1. Create the converter:
a. Select File > New > Convert to XML from the Stylus Studio menu to display the New Converter dialog box.
b. Select the file you want to convert to XML and open it in the Convert to XML Editor.
c. Review the default converter configuration settings displayed in the Convert to XML Editor, and modify as required.
d. Run the adapter and review the conversion results displayed in the Preview window.
e. Save the converter (and, optionally, the XML output for the input file selected in step b).
2. Use the converter to open a new non-XML file of the same type as the file you used to define the converter.

The Convert to XML adapter engine converts the new file to an XML document, displaying it in the Stylus Studio editor you specify when opening the file.

The steps in this process are described in greater detail in the following sections.

Other Ways to Convert Files to XML

In addition to creating your own converter, you can convert files to XML

  • Using Stylus Studio's built-in converters - Stylus Studio comes bundled with built-in converters for numerous file formats, including CSV, dBase, and Windows .ini files. See Types of Converters for more information on this topic.
  • Using Stylus Studio document wizards - Stylus Studio document wizards help you convert CSV and fixed-width files to XML. See Converting Text Files to XML Documents.
 
Free Stylus Studio XML Training: