Add DOCTYPE Declaration Component

Our current infrastructure supports over 200 interfaces with external trading partners in the B2B role. Unfortunately, some of the cXML partners cannot handle Xml Namespaces and insist on receiving DOCTYPES.

Although DOCTYPE’s can be added through the BizTalk mapper, we needed a mechanism to remove the Xml Namespace from the resultant message before passing through to a client. As a result, I created the Add Doctype Declaration encoding component (send pipeline) to add DOCTYPE’s and remove Xml namespaces.

Encode Component on Pipeline

The component uses an Xml Document object to parse the message and add the DOCTYPE declarations. In addition, the Xml Namespace can be removed if required using the [boolean] ‘RemoveNamespace’ property (if this is set to false, the namespace will remain in the final message.

Add DOCTYPE Declaration Component Properties

A project containing source-code and binaries for BizTalk 2004 can be found in the downloads area of this blog, or via this link.

This really is the first release of the component (think of it as beta) and although it is ready for production, there are a number of enhancements I want to make, including:

  1. Produce a version in .Net 2.0 for BizTalk 2006 (our production environment is currently 2004, hence the current code is targeted to .Net 1.1);
  2. For BizTalk 2006, have the component configurable at run-time rather than design-time;
  3. Identify the root element programmatically, rather than through a component property;
  4. Remove DOCTYPE addition from the component and use the mapper to add the declaration;
  5. Create a receive pipeline component to add an Xml Namespace based on a DOCTYPE declaration;

I hope this component will be of use, either in your projects or as a starter for enhancements. I will continue to update the code and release enhancements through this blog.

Happy BizTalking!

11 thoughts on “Add DOCTYPE Declaration Component

  1. I am using this in Biztalk 2006. I can not get the pipeline to work. My Send Ports in Biztalk Adminstrator seem to just ignore this pipeline. Were you able to get a working copy in Biztalk 2006 R2?

    Thanks again for your time and help

  2. Hi Tom,
    I haven’t used this component myself under R2 (its a .Net 1.1 component originally built for BTS2004), but if I get some over the next few days I’ll build a copy and re-publish it.

    Cheers, Nick.

  3. Tom,
    I’ve spent some time looking at the component and it is just plan broken; I will try and find some time in the next month to re-develop for BizTalk 2006 to both remove DOCTYPES as they enter BizTalk and add them on the way out.

    Rgds, Nick.

  4. Its coming along, just not quite as fast as I would have hoped – I’ll update the blog once I have a working version.

    Thanks for the patience!

  5. I’m working on the very same thing right now. Have you found anything better to handle cXML and Biztalk? How far have you gone down the road with your own pipeline components for cXML. I thought I’d ask before I start down the path writing my own.

  6. Ryan,
    Unfortunately, I’ve haven’t been able to make much progress – I’d be happy to host your component if you develop something for the community.

    Cheers, Nick.

  7. I have used the code for this in BizTalk 2006 R2 (will send an email containing solution). I am using the pipeline to add the DOCTYPe and send out through a file adapter. when i look at the file it has a lot of whitespace added which is causing validation problems with the application it is being sent to.
    I get a node like

    DTD has

    validation is failing because node1 is not empty.

  8. Hi Stuart,

    Its certainly a while since I blogged about this one, but let me run some tests on it and see whether I can clean the component up a little to resolve this issue.

    Cheers, Nick.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s