Altova XMLSpy 2024 Enterprise Edition

Export to Text Files

Home Prev Top Next
icExportToTextFiles

The command Convert | Export to Text Files exports XML data into text formats for exchange with databases or legacy systems. On clicking this command, the Export XML to Text dialog pops. It consists of two parts (shown in separate screenshots below):

 

an upper part with two tabs: (i) Selection, and (ii) Export Options.

a lower part, which is a Preview window.

 

After you have selected the desired options in this dialog (described below), click the Export button to export to text file/s.

 

Selection

In the Selection tab (screenshot below), you can select the destination of the file to be exported and text generation options.

URefConvert_Exp2Text_Selection

Destination: The exported file can be saved directly to a folder. The file extension can be specified. The filenames will be those of the elements (in the XML file) that will be exported. Alternatively, untitled files can be exported to XMLSpy. These files will be displayed in the GUI, and can be saved later.

 

Include comments: Activate this option to include an XMLSpy-generated comment in the exported XML file. The comment will contain the SQL query used to select the data as well as a list in which there is one listitem for each column header in the database table.

 

Create first row with field names: When activated, the exported tables include the names of columns from the database. Otherwise column names will not be included in the exported text file.

 

Remove delimiters: Removes delimiters that are contained in text values in the exported data. Set the delimiter you want to remove by using the Delimiter combo box in this tab. For example, if this option is activated and the selected delimiter is the apostrophe, when you export the XML value Ba'ker, the string will be Baker in the exported text.

 

Remove newlines: Removes newlines from exported data.

 

Delimiter: Select from the drop-down list the character that you wish to have removed during export. Alternatively, enter the desired character string.

 

Encoding: Select from the drop-down list, the desired encoding for files that are generated during export.

 

Byte order: If you are exporting 16-bit or 32-bit Unicode (UCS-2, UTF-16, or UCS-4) files, you can also switch between little-endian and big-endian byte order.

 

Export Options

Additional export options, which are described below, can be specified in the Options tab (screenshot below):

URefConvert_Exp2Text_ExpOptions

Start point of export: You can choose to export the entire XML document or restrict your export to the data hierarchy starting from the currently selected element. The number of sub-levels below the start point that will be exported is specified in the Export Depth option.

 

Export depth: Specifies the number of sub-levels below the start point that will be exported.

 

Export fields: Depending on your XML data, you may want to export only elements, attributes, or the textual content of your elements. Note that you can also deselect the export of individual elements in the Preview window.

 

Automatic fields: XMLSpy will produce one output file or table for each element type selected. You can choose to automatically create primary/foreign key pairs to link your data in the relational model, or define a primary key for each element.

 

Exclude namespace name: Together with the Replace Colon With Underscore radio button this is an either/or choice. Specifies whether namespace prefixes of elements and attributes should be excluded or whether the colon in the namespace prefix should be replaced with an underscore.

 

Apply Options: After you have set options, click this button to apply the options. The preview in the preview pane will be updated with the new options.

 

 

Preview window

The Preview window (screenshot below) is displayed below the Selection and Options tabs.

URefConvert_Exp2Text_Preview

The Resulting Elements from XML File pane shows the node names that will be exported and the name in the generated file. You can select/deselect nodes that will be exported. When an element is selected, a preview of its structure is shown in a second pane below. In this pane, clicking to the left of a column header name toggles the export of that column on and off. In the screenshot above, the last column (FK_Office) has been toggled off.

 

© 2017-2023 Altova GmbH