The New Message Model wizard is the usual way to create a DFDL schema in the IBM Integration Bus Toolkit, enabling you to import Cobol copybooks or C headers for binary models, or to use prompts from the wizard to get you started with creating text models. But sometimes your starting point might be an ordinary XML schema. For example, you have an XML document and you want to create an equivalent CSV data file. The following steps show you how to turn your XML schema into a DFDL schema.
- Import the XML schema into a library.
- Open the XML schema using the eclipse XML editor.
- Use the Source tab to add these two xmlns namespace declarations to the xs:schema statement: xmlns:dfdl=”http://www.ogf.org/dfdl/dfdl-1.0/” and xmlns:fn=”http://www.w3.org/2005/xpath-functions”.
- Save and close the schema – it is now a DFDL schema. (You will see several errors in the Problems view – don’t worry about them just yet.)
- Open the DFDL schema using the DFDL schema editor.
- In the main editor window you will see ‘Schema references’. Expand the twistie and click on the ‘Add schema reference’ icon that is revealed.
- Select the 2nd radio button ‘Reference an IBM supplied data format’ and choose the most appropriate one for your format.
- Save the DFDL schema.
- Back in the main editor you will see a prominent warning, suggesting to add a default format to the xsd. Click on the link to add one.
- Select the default format object, and in the ‘Representation properties’ tab on the right, click on the Data Format Reference property (1st under ‘General’). This will show you a format added as a result of step 7. Select it.
- Save the DFDL schema. This should remove the majority of errors from the Problems view.
- DFDL uses a subset of XML Schema 1.0, so if your schema uses constructs that are not in the subset, you will see errors in the Problems view. You need to remove the constructs from the schema, which is best done using the XML editor again.
- Correct any errors remaining in the Problems view.
- Complete your model by setting the appropriate DFDL properties and any other DFDL annotations on the objects in the schema.