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.
We tried validating an XML message as below.
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:
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.
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.
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.