Importing from XML schemas to create message definitions

You can populate a message set with message definitions by importing XML Schema files, using either the New Message Definition File wizard or the mqsicreatemsgdefs command line utility.

Each XML Schema file you import results in a new message definition file within the message set. The root name of the message definition file defaults to the root name of the XML Schema file, but the New Message Definition File wizard allows you to choose a different root file name.

If the message definition file already exists, you must have permitted overwriting to occur for the import to proceed, in which case the existing content is deleted and recreated.

The namespace to which the message definition file created belongs depends on whether namespaces have been enabled for the message set.

A report file is created during the import operation. This is located by default in the log folder of the message set. By default it takes the name of the message definition file, with .report.txt appended.

Import using the New Message Definition File wizard

When you import using the New Message Definition File wizard, you can specify which of the global elements within the imported XML Schema file are to be messages within the message definition file.

You can only import one XML Schema file with each import operation. If your XML Schema file references other XML Schema files, with import or include elements, these XML Schema files must be imported with a separate import operation into the same message set.

Import using the command line

When you import using the command line you have the option of either creating no messages or creating a message for each global element within the imported XML Schema file. The import operation creates a message and corresponding global element in the message definition file for each global element you specify. If you do not specify that messages are to be created, you must create them manually using the message definition editor after the import has completed.

You can import several XML Schema files in each import operation.

Physical information

As well as creating logical information, the import can also create physical information. If the message set contains any XML wire format physical formats, then the physical format properties for all XML Wire Format layers is populated. If the message set does not contain any XML physical formats, only logical information is created. Also, if you import from the command line, only logical information is created in the new message set by default. If you want physical information created as well, see Importing from the command line for details.

CWF and TDS physical format properties are not populated and so take default values.

If you have one or more CWF or TDS layers, the import can cause entries in the task list, warning you that certain CWF or TDS properties must be set if the XML structures you have imported were to appear in a CWF or TDS message.

If the CWF or TDS physical formats are not applicable to your XML structures, you can ignore these task list entries because they are just warnings, they will not prevent your model being generated in another form, such as a message dictionary.

Command line invocation

The mqsicreatemsgdefs command line utility allows you to import several XML Schema files in a single operation. All the XML Schema files must be in single directory and the directory location passed as a parameter to the utility.

When you import into a message set for which namespaces are not enabled, the action to take for unsupported constructs can be specified using an XML options file. This must contain an XML element called <XSD_NO_NS> which holds a set of information that applies to all XML Schema files imported during an invocation of the utility. A default XML options file is supplied called mqsicreatemsgdefs.xml. If you wish to apply different sets of information to different XML Schema files, you need to create multiple XML files and run the utility multiple times.

There are 2 other options that you can specify in the <XSD_NO_NS> element in the XML options file when importing into a message set for which namespaces are not enabled:

The mqsicreatemsgdefs utility also allows you to create a new message set into which the message definition files are placed, as part of the import operation. You can also choose to base the message set created on an existing message set. This facility enables you to prepare an empty message set containing a XML physical format and pre-populated message set level XML properties, which are then copied into the message set created by the import.

Further information about XML Schema

For details about XML Schema, see XML Schema Part 0: Primer on the World Wide Web Consortium (W3C) Web site.