Importing and Exporting Setting Files to/from XML Format

You can import and export setting files to and from XML format using the following commands:

CATBatGenXMLSet
CATBatImpXMLSet

Certain attributes in certain settings files, when exported to XML format, cannot be converted to text. The setting files concerned are:
  • FrameConfig.CATSettings
  • FrameGeneral.CATSettings
  • DLNames.CATSettings (which can only be exported in any case using the CATSysDLExport tool).

This renders these settings files unusable after exporting them to XML format.

On Windows

1. Change to the default folder in which you installed the product.

On Windows, the default folder is:

C:\Program Files\Dassault Systemes\B18\intel_a\code\bin (Windows XP Pro)
C:\Program Files\Dassault Systemes\B18\win_b64\code\bin (64-bit code on Windows XP Professional x64 Edition)
C:\Program Files (x86)\Dassault Systemes\B18\intel_a\code\bin (32-bit code on Windows XP Professional x64 Edition)

2. Enter the command:

CATBatGenXMLSet

or:

CATBatImpXMLSet

with the appropriate arguments.

On UNIX

1. Log on as root or end user.
2. Enter the command:

/usr/DassaultSystemes/B18/OS/code/bin/CATBatGenXMLSet

or:

/usr/DassaultSystemes/B18/OS/code/bin/CATBatImpXMLSet

with the appropriate arguments.

Exporting an XML Set from a Settings File

The CATBatGenXMLSet command reads any setting file and to generate an XML file from it. The syntax is:

CATBatGenXMLSet Output_directory SettingName [mode]

The arguments are:

  • Output_directory: name of the directory where the XML file will be created. Example: /tmp.
  • SettingName: name of the CATSettings file (without the .CATSettings extension) that you want to export to XML format. Example: CATStatistics.
  • mode: optional argument, specify -admin in order to run the command in administrator mode, which has the effect of creating the resulting file in the administrator settings environment. The default mode is user mode. No extension.
    If you want to understand what administrator mode is and what it is used for, refer to How Settings are Concatenated and Inherited and Locking Settings.
    General information about settings is provided in About Settings.

Batch Output

The name of the resulting file is SettingName.xml.

Example

CATBatGenXMLSet /tmp Statistics

Example of output

Let's say we have a settings file named Example.CATSettings comprising the following attributes:

Length of type float explicitly set to 17.132
Weight of type long not explicitly set (code default)
Number of type integer explicitly set to [1,2,3]

The resulting XML file will be as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CATSettingRepository [
<!ELEMENT CATSettingRepository (Attribute*)>
<!ATTLIST CATSettingRepository Name NMTOKEN #REQUIRED>
<!ELEMENT Attribute (Value*)>
<!ATTLIST Attribute Name NMTOKEN #REQUIRED
Type CDATA #REQUIRED
Size NMTOKEN #REQUIRED
Lock (Locked|JustLocked|Unlocked) "Unlocked">
<!ELEMENT Value (#PCDATA)>
]>
<CATSettingRepository Name="Example">
<Attribute Name="Length" Type="float" Size="1">
<Value>17.132</Value>
</Attribute>
<Attribute Name="Weight" Type="long" Size="0">
</Attribute>
<Attribute Name="Number" Type="int" Size="3">
<Value>1</Value>
<Value>2</Value>
<Value>3</Value>
</Attribute>
</CATSettingRepository>

Note that a size of 0 means that the attribute has not been explicitly modified anywhere in the concatenation. Its value is also the default value of the code.

Importing an XML Set to a Setting File

The CATBatImpXMLSet command reads an XML settings set and generates the settings in the current V5 environment from it.

CATBatImpXMLSet XML_File [mode]

The arguments are:

  • XML_File: path of the XML file to import into the current V5 environment. Example: /tmp/CATStatistics.xml.
  • mode: optional argument, specify -admin in order to run the command in administrator mode, which has the effect of creating the resulting file in the administrator settings environment. The default mode is user mode.
    If you want to understand what administrator mode is and what it is used for, refer to How Settings are Concatenated and Inherited and Locking Settings.
    General information about settings is provided in About Settings.

Batch Output

The output is a settings file in the user settings repository of the current V5 environment, for example Statistics.CATSettings.

Example

CATBatImpXMLSet /tmp/Statistics.CATSettings

 

General Remarks

After either exporting or importing settings files, a message like this appears confirming the operation has succeeded:

Setting xxx has yyy attributes successfully exported/imported

depending on the case, where "xxx" is the settings file name and "yyy" is the number of attributes.

If the exported file is already present, the previous file will be overwritten.

Certain settings files may be empty. If you attempt to export an empty settings file, the following message is displayed:

Setting xxx is empty

where "xxx" is the settings file name, but the resulting XML file is still generated.

We recommend that you do not edit the XML files manually, since the syntactical coherence of setting files is guaranteed by the interactive Tools->Options... command.

We advise that you use this export/import facility simply as a means of capturing the state of your configuration settings at a specific point in time, for the purpose of restoring the same settings for another configuration.