Load dataset with inline schema: Invalid 'Key' node inside constraint

  • Thread starter Thread starter Richard Lee
  • Start date Start date
R

Richard Lee

I'm getting "Invalid 'Key' node inside constraint" when I
load a typed dataset with ReadXml and XMLReadMode parm
set to ReadSchema.

I've written an inline schema to the xml file previously,
along with some data, using the typed dataset class. I
have a simple relationship of PK in table 1 to FK in
table 2. I've tried fiddling with the settings in the
dataset wizard relationship dialog, and I've also tried
writing the relationships directly from code. t1PK is set
as a primary key, t2FK is set as a key also.

Here's the schema fragment - the error refers to 't1Key':

<xs:keyref name="t1t2" refer="t1Key">
<xs:selector xpath=".//mstns:t2" />
<xs:field xpath="mstns:t2FK" />
</xs:keyref>

Thanks in advance
Big Rich
 
I had a similar problem. Eventually I discovered that it was caused by a
case-sensitivity problem. The name of the element and the way it was
referred to in the xs:key used different case. After fixing that problem, I
no longer got the Invalid 'Key' node inside constraint error.
 
Back
Top