Multiple data type for BizTalk Schema elements

 

Exception:

The XML Validator failed to validate. Details: The xsi:type attribute value ‘http://www.w3.org/2001/XMLSchema:double’ is not valid for the element ‘http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value’, either because it is not a type validly derived from the type in the schema, or because it has xsi:type derivation blocked.

SampleSchema.jpg

Explanation:

This issue is occurred when we validate the schema. Main reason is that for a element field the data type is defined more than one format e.g. in below xml file value field has data type double and string both. so when we validate this xml with schema then it throws exception.

Resolution:

When any element has more than one datatype then we need also define this in schema property as below:

Select element and open properties window of that element as below:

Expend Advanced in Properties-> Derived By->  Select Union

SampleSchemaProperties1.jpg

Now select multiple datatypes which is required in Member Types.

Note: You can not select all data types in Member Types

SampleSchemaProperties2.jpg

 

Now save the change and validate the xml with validate instance, it will working fine.

Advertisements