Message Image  

Creating a DFDL schema from XML schema

 View Only
Tue July 14, 2020 10:05 AM

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.

  1. Import the XML schema into a library.
  2. Open the XML schema using the eclipse XML editor.
  3. 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”.
  4. 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.)
  5. Open the DFDL schema using the DFDL schema editor.
  6. In the main editor window you will see ‘Schema references’. Expand the twistie and click on the ‘Add schema reference’ icon that is revealed.
  7. Select the 2nd radio button ‘Reference an IBM supplied data format’ and choose the most appropriate one for your format.
  8. Save the DFDL schema.
  9. 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.
  10. 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.
  11. Save the DFDL schema. This should remove the majority of errors from the Problems view.
  12. 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.
  13. Correct any errors remaining in the Problems view.
  14. Complete your model by setting the appropriate DFDL properties and any other DFDL annotations on the objects in the schema.

5 comments on"Creating a DFDL schema from XML schema"

  1. Pawan July 05, 2017

    Can we create DFDLs from header files as well. Or from TPF macros.

    Reply (Edit)
    • stevehanson July 05, 2017

      You can create DFDL schemas from C header files and from COBOL copybooks, using the eclipse wizard. There isn’t a way to create DFDL schemas from TPF macros, however there is a new feature in HLASM that creates DFDL schemas from Assembler DSECTs as a by-product of the assembly process.

      For more information, see “Creating a DFDL schema file by using the New Message Model wizard” https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/df00100_.htm

      Reply (Edit)
  2. Federico March 22, 2016

    Thanks for the clarification. Maybe in a future fix or version you can add a right click wizard for this common operation. Such functionality would be very helpful even when migrating from an older version (6.1 in my case).

    Reply (Edit)
  3. Federico March 16, 2016

    Once converted in a DFDL schema can I still use it to validate an XML file using XMLNSC domain or I must use DFDL domain? Tnx

    Reply (Edit)
    • stevehanson March 16, 2016

      A DFDL schema is also a valid XML schema. When it is deployed to the runtime, a DFDL grammar is generated for the DFDL parser AND an XML grammar is generated for the XMLNSC parser. So you can use it for parsing the non-XML format and/or for validating the (equivalent) XML format.

      Reply (Edit)

#IntegrationBus(IIB)
#DFDL
#XML-schema
#AppConnectEnterprise(ACE)