Validation error for schema with Any-element

At the company I am working for, the goal is to have Unit tests for every mapping and flow. One of the schemas we are using is a generic schema that we use to send insert statements to SQL Server. This schema contains an <Any>-element, as you can see in below image.

Schema

We tried validating an XML message as below.

XML Message to validate

As you can see, technically this document should validate justĀ fine since the root node is correct, namespace is correct and the rest of the body content should be ignored. However, when trying to validate the message using Visual Studio or via BizUnit, we get following error:

Error Message on validation

Solution

To resolve this issue, you should go back to the schema in Visual Studio. Now go to the XSD definition of the file to be generated and select the <Any> element. And view the properties of this node. We are especially interested in the ‘Process Content’ property. Initially, this property will have the value (Default) set and as a result the processContents attribute will not be added to the <Any>-element. With these settings BizTalk will validate the content of this item, causing the validation error as mentioned.

Schema Any-element Properties

Now change the value of this ‘Process Content’ property to Skip and you will notice the processContents attribute will be added to the <Any>-element in the XSD schema definition.

Changed Schema with the ProcessContent attribute

Having the property set to Skip, BizTalk will not validate the content of the -element. This is exactly the behavior that we expected and this time our test succeeded.

Succesful validation test