Labels

Monday 2 December 2019

Generating an XSD from a DTD (without the Generated Items Wizard)

Whilst trying to generate an XSD from a DTD in BizTalk I came across a problem.  The standard process of creating an XSD from a DTD is to add generated items and then select DTD from the list (provided the dropdown option does not have “Not Loaded” next to it) and then point the wizard at the appropriate DTD file in order to create the schema (XSD).  This usually ends up building more than one XSD and you have to manually glue them together.  However using BizTalk Server 2016 even with the latest Feature Pack update (with CU 6), the process errors.

A way around this problem is to use the XML tools within Visual Studio :-

Open your DTD file in Visual Studio

Next go to the XML menu (Green arrow in the image below) on the Toolbar and select Create Schema (Blue arrow in the image below)


Immediately after in the same pane as your DTD, you will see a number of other tabs appear, these are the XSDs that have been generated from your DTD.  


By default these are created in the following directory … C:\Users\[your username]\AppData\Local\Temp, so you will need to add them into your schema project and then link them together using the import schema functionality.  

Also due to the way the XSDs are created you will need to find the root node in the controlling schema and move it to the top of the node list …. This will enable to generate an XML instance for testing etc 

No comments:

Post a Comment