constraint not declared

Discussion in 'XML' started by Bart V, Apr 23, 2004.

  1. Bart V

    Bart V Guest

    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>
     
    Bart V, Apr 23, 2004
    #1
    1. Advertising

  2. (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:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Apr 23, 2004
    #2
    1. Advertising

  3. Bart V

    Bart V Guest

    Henry S. Thompson wrote:
    > (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>
     
    Bart V, Apr 23, 2004
    #3
  4. Bart V

    Bart V Guest

    Oeps my mistake I didn't load in the datagrid, it works now thx for your
    help.

    grtz Bart
     
    Bart V, Apr 23, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rajesh Tiwari

    Can Not Access Foreign Key Constraint

    Rajesh Tiwari, Jun 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    660
    Rajesh Tiwari
    Jun 30, 2003
  2. JohnZing

    declared or not declared ?

    JohnZing, Feb 5, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,606
    Jon Paal
    Feb 5, 2006
  3. lostlander
    Replies:
    5
    Views:
    424
    Keith Thompson
    Dec 10, 2007
  4. puvit82
    Replies:
    4
    Views:
    768
    puvit82
    Feb 1, 2008
  5. Chris Angelico

    Re: [GENERAL] DEFERRABLE NOT NULL constraint

    Chris Angelico, Feb 5, 2013, in forum: Python
    Replies:
    0
    Views:
    106
    Chris Angelico
    Feb 5, 2013
Loading...

Share This Page