I have an XML document that I'm reading into a dataset. I programmatically
created dataadapters and constraints for all the tables and relationships and
I'm able to insert all the data into the database no problem. Instead of
running the code to create the constraints all the time, I used
WriteXMLSchema to write out an .xsd for me that has everything already
defined. Now when I read this schema back using ReadXMLSchema, I get the
error:

Invalid 'Key' node inside constraint named: Arrests-Inv_Holding_Facilities

.NET created this .xsd for me, why can't it read it in? I've made no
changes to it manually. I've seen several messages with this same question
out on the web, but no answers. Can anyone tell me what the problem is?

RE: Invalid Key node inside constraint error by tparks69

tparks69
Wed May 25 15:22:13 CDT 2005

I found the answer myself. Evidently ReadXMLSchema doesn't like it when you
read in the XML before you read in the Schema. : ) Read the schema first
and no problems.

"tparks69" wrote:

> I have an XML document that I'm reading into a dataset. I programmatically
> created dataadapters and constraints for all the tables and relationships and
> I'm able to insert all the data into the database no problem. Instead of
> running the code to create the constraints all the time, I used
> WriteXMLSchema to write out an .xsd for me that has everything already
> defined. Now when I read this schema back using ReadXMLSchema, I get the
> error:
>
> Invalid 'Key' node inside constraint named: Arrests-Inv_Holding_Facilities
>
> .NET created this .xsd for me, why can't it read it in? I've made no
> changes to it manually. I've seen several messages with this same question
> out on the web, but no answers. Can anyone tell me what the problem is?

Re: Invalid Key node inside constraint error by Sahil

Sahil
Wed May 25 17:14:13 CDT 2005

Actually the problem is slightly different.

The XML Document that you read *before* - has data that is inconsistent with
the schema.

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/



"tparks69" <tparks69@discussions.microsoft.com> wrote in message
news:CA277715-143C-4746-900F-5C15A43BFB42@microsoft.com...
> I found the answer myself. Evidently ReadXMLSchema doesn't like it when
you
> read in the XML before you read in the Schema. : ) Read the schema
first
> and no problems.
>
> "tparks69" wrote:
>
> > I have an XML document that I'm reading into a dataset. I
programmatically
> > created dataadapters and constraints for all the tables and
relationships and
> > I'm able to insert all the data into the database no problem. Instead
of
> > running the code to create the constraints all the time, I used
> > WriteXMLSchema to write out an .xsd for me that has everything already
> > defined. Now when I read this schema back using ReadXMLSchema, I get
the
> > error:
> >
> > Invalid 'Key' node inside constraint named:
Arrests-Inv_Holding_Facilities
> >
> > .NET created this .xsd for me, why can't it read it in? I've made no
> > changes to it manually. I've seen several messages with this same
question
> > out on the web, but no answers. Can anyone tell me what the problem is?