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.

 

1.

We have the schema

 

Pict.1

 

and the Input instance file: 

 

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

  <ns0:Record>

    <ns0:B>B<ns0: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.

 

 

2.

 

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

  <ns0:Record>

    <ns0:B>B<ns0:B>

    <ns0:C_4>C_4<ns0: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.

 

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

Feedback

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

left by Rohit Sircar at 10/13/2008 2:39 AM Gravatar
Another cause of this error is if the "Validate Instance Input Type" is set to "XML". Change this property of the schema to "Native" and it can also resolve the issue.
Post A Comment
Title:
Name:
Email:
Comment:
Verification: