473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

constraint not declared

If I try to load a xml schema in a dataset I get this error:
The 'CDSKey1' identity constraint is not declated. An error occurred
at file:///C:/Doc.../CDLib.xsd, (36, 4).

Here is the schema:

<?xml version="1.0" standalone="yes" ?>
<xsd:schema id="CDLib" targetNamespace="CDLib" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="CDS" msdata:IsDataSet="true"
msdata:Locale="en-GB">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="CD">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0" />
<xsd:element name="DevID" type="xsd:integer" minOccurs="0" />
<xsd:element name="PosID" type="xsd:integer" minOccurs="0" />
<xsd:element name="Title" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Art">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0" />
<xsd:element name="CDID" type="xsd:integer" minOccurs="0" />
<xsd:element name="Data" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
<xsd:key name="CDSKey1" msdata:PrimaryKey="true">
<xsd:selector xpath=".//CD" />
<xsd:field xpath="ID" />
</xsd:key>
<xsd:key name="CDSKey2" msdata:PrimaryKey="true">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="ID" />
</xsd:key>
<xsd:keyref name="CDArt" refer="CDSKey1">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="CDID" />
</xsd:keyref>
</xsd:element>
</xsd:schema>
Jul 20 '05 #1
3 3243
ba**************@hotmail.com (Bart V) writes:
If I try to load a xml schema in a dataset I get this error:
The 'CDSKey1' identity constraint is not declated. An error occurred
at file:///C:/Doc.../CDLib.xsd, (36, 4).

Here is the schema:

<?xml version="1.0" standalone="yes" ?>
<xsd:schema id="CDLib" targetNamespace="CDLib" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> .. . . <xsd:keyref name="CDArt" refer="CDSKey1">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="CDID" />
</xsd:keyref>

Like all names declared in a schema, CDSKey1 is declared in your
target namespace, so you need a proper qualified name to refer to it.

So add xmlns:cdl="CDLib" to your xsd:schema element, and change your
xsd:keyref to say refer="cdl:CDSKey1"

You will also need to change all your XPaths to use this prefix as
well, or none of them will match.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jul 20 '05 #2
Henry S. Thompson wrote:
ba**************@hotmail.com (Bart V) writes:

If I try to load a xml schema in a dataset I get this error:
The 'CDSKey1' identity constraint is not declated. An error occurred
at file:///C:/Doc.../CDLib.xsd, (36, 4).

Here is the schema:

<?xml version="1.0" standalone="yes" ?>
<xsd:schema id="CDLib" targetNamespace="CDLib" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">


. . .
<xsd:keyref name="CDArt" refer="CDSKey1">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="CDID" />
</xsd:keyref>


Like all names declared in a schema, CDSKey1 is declared in your
target namespace, so you need a proper qualified name to refer to it.

So add xmlns:cdl="CDLib" to your xsd:schema element, and change your
xsd:keyref to say refer="cdl:CDSKey1"

You will also need to change all your XPaths to use this prefix as
well, or none of them will match.

ht

Hi I did what u said, but I think I'm doiing something wrong. Now I
doesn give me errors it gives me nothing! It dont load the schematic.
Here is the altered schematic:
<?xml version="1.0" standalone="yes" ?>
<xsd:schema id="CDLib" targetNamespace="CDLib" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:cdl="CDLib">
<xsd:element name="CDS" msdata:IsDataSet="true" msdata:Locale="en-GB">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="CD">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0" />
<xsd:element name="DevID" type="xsd:integer" minOccurs="0" />
<xsd:element name="PosID" type="xsd:integer" minOccurs="0" />
<xsd:element name="Title" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Art">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0" />
<xsd:element name="CDID" type="xsd:integer" minOccurs="0" />
<xsd:element name="Data" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
<xsd:key name="CDSKey1" msdata:PrimaryKey="true">
<xsd:selector xpath=".//CD" />
<xsd:field xpath="ID" />
</xsd:key>
<xsd:key name="CDSKey2" msdata:PrimaryKey="true">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="ID" />
</xsd:key>
<xsd:keyref name="CDArt" refer="cdl:CDSKey1">
<xsd:selector xpath=".//Art" />
<xsd:field xpath="CDID" />
</xsd:keyref>
</xsd:element>
</xsd:schema>
Jul 20 '05 #3
Oeps my mistake I didn't load in the datagrid, it works now thx for your
help.

grtz Bart
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeremiah Jacks | last post by:
I just upgraded to MySQL 4.0.14-standard for RedHat Linux and am using = the pre-compiled binaries. I have a database with INNODB tables. When I insert a row into one of the child tables, I get...
3
by: Dave Sisk | last post by:
Hi Folks: I'm a little new to SQLServer, so please pardon my ignorance! I've found the INFORMATION_SCHEMA views for TABLES, COLUMNS, and TABLE_CONSTRAINTS. I'm looking for the views that will...
4
by: wkaras | last post by:
I would like to propose the following changes to the C++ Standard, the goal of which are to provide an improved ability to specify the constraints on type parameters to templates. Let me say from...
1
by: Bart V | last post by:
If I try to load a xml schema in a dataset I get this error: The 'CDSKey1' identity constraint is not declated. An error occurred at file:///C:/Doc.../CDLib.xsd, (36, 4). Here is the schema: ...
4
by: Jethro Guo | last post by:
C++ template use constraint by signature,It's very flexible to programmer but complex for complier, and at most time programmer can not get clear error message from complier if error occur. C#...
3
by: Brandon | last post by:
Hi everyone. I need to drop a foreign key constraint from a table (or add an "ON DELETE SET DEFAULT") but the constraint is unnamed. Is there anyway to do that? I looked online but didn't find...
15
by: Frank Swarbrick | last post by:
I have the following three tables DROP TABLE CALLTRAK.SERVICE_CODES @ CREATE TABLE CALLTRAK.SERVICE_CODES ( CODE CHAR(1) NOT NULL , CONSTRAINT SERVICE_CODES_PK PRIMARY KEY (CODE) ,...
12
by: Pietro Cerutti | last post by:
Dear all, I would like to open another topic to try to clarify a doubt raised on my previous post today with the subject 'printf("%d%d%d")'. Reading through the standard, I cannot find a clear...
4
by: popprem | last post by:
hi, i'm getting a warning which says that identity constraint is not declared in the <keyref > tag. Can any1 pls help? thanks in advance. part of the xml schema :- <xsd:key name =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.