BizTalk : XML Instance Validation against Schema

While working with an XML Schema, my team found that BizTalk compares the order of the fields as well while validating the instance with the schema. This lead to a big problem in our case. I don’t know why BizTalk considers the order of the fields? As per Database concepts, we say Relational Database doesn’t account order of the columns in the table. XML is also treated as one of the RDBMS. For me it was a surprise.  In our case, we were loading an XML schema in a Dataset and then using UI, we were generating the XML instance based on the user input for the various fields in the schema. Dataset rearranges the schema when you get the schema back from the dataset. It usually puts all the child tables at the last. Because of this when you supply the XML instance (using DS.getXML()), the order of the fields are not the same as it was initially while loading in the dataset. When this instance goes to BizTalk for validation, it returns failure. To sort this problem, my team mate wrote a custom XSL Transfrom to reorder the fields in the XML instance before sending it to BizTalk. My Point is : Why the BizTalk XML Instance Validator checks for the order?

Comments (3)

  1. montaque says:

    because the xsd behind the schema use "sequence" to order the fields.

  2. sandeep says:

    Thanks for the answer.

  3. Yep…it’s because the Microsoft BizTalk team wrote their tools to comply with the standard.  In any case, XML data is not relational!!

    At the risk of inviting the usual howl of indignation from the anti-MS crowd to, I have always found that Microsoft’s handling of XSD in its BizTalk tools seems to be very faithful to the standard – I will resist the temptation to name and shame at least one well-know non-Microsoft tool whose shortcomings in this respect I only discovered by using it alongside BizTalk (for example, it allowed entirely non-legal ‘restrictions’ on simple types).