Following on from a previous post about cXML schemas I show how to migrate a cXML BizTalk solution to an Azure solution. Additionally I give a way of pre-processing DTD messages into XML in Azure.
BizTalk cXML DTD solution
Prior to the release of BizTalk 2016 CU6 using custom pipeline components did the job. Firstly remove the DOCTYPE code using a regular expression as shown below.
Secondly another pipeline component adds an XML namespace. Finally a the custom receive pipeline below creates the desired XML message.
This improvement adds a new property DtdProcessing to the XML Disassembler pipeline component with the following possible values:
- Parse: DTD processing will be enabled.
- Ignore: DOCTYPE element will be ignored and no DTD processing will occur.
- Prohibit: DTD processing will be disabled, and any incoming XML messages that use DTD will get suspended.
If no value is specified, DTD will get processed by default.
In conclusion a BizTalk Receive pipeline can create valid XML from a cXML DTD message.
Azure cXML DTD solution
The solution here will use an azure function to remove the DOCTYPE declaration and add an XML namespace. Firstly the solutions to remove the DOCTYPE is unremarkable and the same code is above used . Adding the XML namespace was a bit harder because the optimized BizTalk class libraries are not available. In the end the solution uses an XMLReader and a XMLNamespaceManager to add the Namespace.
Pre-Processing of DTD messages to XML in an Azure function allows the resulting XML to be used in other Azure components. For example a logic App could use existing BizTalk Map logic to transform this cXML message.
In conclusion an Azure function can create valid XML from a cXML DTD message.