Convert DTD to XSD schemas

Posted: June 8, 2019  |  Categories: BizTalk
Tags: DTD XML XSD

This posts tells you how to convert DTD schemas into BizTalk XSD schemas. Additionally, I share my experiences working with cXML DTD and BizTalk Server here.

#1 Azure Monitoring Platform

Convert DTD schemas with BizTalk Tools

BizTalk Server cannot use a DTD schema unless you convert it to a XSD schema first. An example of a standard using DTD’s is cXML (commerce eXtensible Markup Language).

Sandro Pereira wrote an excellent primer about how to use BizTalk Server tools to generate a XSD from a DTD here.

Firstly downloading the Fulfill.zip I obtained the DTD. Running the BizTalk 2016 generate schema tool following Sandro I do not get a new XSD schema. Most importantly I get this error;

Generate Schema from DTD error using BizTalk Tools

I think something is broken. Finally doing the same thing on another BizTalk 2016 Development Server I get the error as well.

Convert DTD schemas using Visual Studio

Firstly follow this article here. This does generate three schemas like this;

Secondly save the Fulfill.xsd and add it to the BizTalk project. I choose to not use the other referenced schemas because they are not required for what I want to do. Opening the XSD I get this error. Press OK and the schema appears in the left hand pain. Next I will massage the schema to get it how I like it.

Thirdly change the namespace to something I want. Validating the schema with right click “Validate Schema” from the menu yields errors .

Fourthly open Imports Collection option on the left hand menu, delete the line with the ds prefix and the one with a blank prefix. Fifthly open the schema in an XML editor, replace ref=”xml: with name=” and comment out the uri:ds element. I am doing this because we do not require the signature node in our messaging and we will add xml:lang using XSLT.

Finally validating the schema is successful.

Using this schema to send a DTD

First create map using this schema as the destination schema. Secondly create the XSLT using “Validate map”. Thirdly configure the map to use the XSLT instead of JIT compilation. Fourthly replace name = “lang” with name = “xml:lang”. Fifthly configure map as outbound on the send port.

Finally configure a custom pipeline on the send port to add DTD declaration to the message.

Conclusions

In my hands the BizTalk DTD to XML generator tool no longer works. Furthermore this blog shows a workaround using the create schema option available within Visual Studio itself. Please let me know how to get the
BizTalk DTD to XML generator tool to work in BizTalk 2016.

Postscript 10/06/2019

In BizTalk 2016 CU6 there is a new feature for receiving DTD messages.

Unfortunately there is no change to the XML Assembler to allow addition of a DOCTYPE element.

Postscript 12/06/2019

The BizTalk Schema generator tool does work with Rosetta Net DTD’s. It seems that it does not work with cXML DTD’s. Thanks Sandro for pointing this out.

#1 Azure Monitoring Platform
turbo360

Back to Top