BizTalk 2004: Schema validation: Error in the "error BEC2004"?

“Error BEC2004” in BizTalk 2004 is a tricky error in some cases.

For examples I use simplyfied schemas to highlight the source of the problem.

We have the schema

Pict.1

and the Input instance file: 

<ns0:Root xmlns:ns0="http://Schemas.Schema1">

  ns0:Record\

    ns0:B\Bns0:B\

  ns0:Record\

>

Try to “Validate Instance“ and oops!

- we've got an error:

... error BEC2004: The element 'http://Schemas.Schema1:Record' has incomplete content. Expected 'http://Schemas.Schema1:C http://Schemas.Schema1:C\_2 http://Schemas.Schema1:C\_3 http://Schemas.Schema1:C\_4 http://Schemas.Schema1:C\_5 http://Schemas.Schema1:C\_6 http://Schemas.Schema1:C\_7 http://Schemas.Schema1:**D**'...

It looks very disappointing. Why have we got the error for all C_x elements if property the "Min Occurs" = 0? The answer is in a D element. It has property the "Min Occurs" = default (=1). The parser can not understand what the next node should be after node B. It can be any of C_x or D. The parser gives the error BEC2004 with list all possible nodes. And this list start with node C, of course! The error message is right but very disappointing. We are not waiting the errors for C_x nodes!

Conclusion: If you got the error BEC2004 with list of nodes, look at the end of this list. The last node should have the "Min Occurs" property equal 1 (or default) and the previous nodes should have this property = 0.

That means we've lost the instance of the last node in the instance of the xml document.

<ns0:Root xmlns:ns0="http://Schemas.Schema1">

  ns0:Record\

    ns0:B\Bns0:B\

    ns0:C\_4\C_4ns0:C\_4\

  ns0:Record\

>

a. for Pict.1 We have the property "Max Occurs"=unbounded for C_x and D elements.

 ... error BEC2004: The element 'http://Schemas.Schema1:Record' has incomplete content. Expected 'http://Schemas.Schema1:**C\_4** http://Schemas.Schema1:C\_5 http://Schemas.Schema1:C\_6 http://Schemas.Schema1:C\_7 http://Schemas.Schema1:D'...

We've got the error not only disappointing but erroneous. Why did the parser point to the C_4 node???

b. Change the schema:

Pict.2.

MissedNode defaultvi vi

We change the property "Max Occurs" to default (=1) for C_x and D elements.

... error BEC2004: The element 'http://Schemas.Schema1:Record' has incomplete content. Expected 'http://Schemas.Schema1:C\_5 http://Schemas.Schema1:C\_6 http://Schemas.Schema1:C\_7 http://Schemas.Schema1:D'...

Now we've got the error only disappointing. It is not an error in it.

Conclusion: If you got the error BEC2004 with list of nodes, look ONLY at the end of this list. It is possible you HAVE an instance of a node which is the first in the list of nodes.

Print | posted on Monday, February 27, 2006 3:17 PM

This article is part of the GWB Archives. Original Author: Leonid Ganeline

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.