constraint not declared

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bart V

    #1

    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="u rn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="CDS" msdata:IsDataSe t="true"
    msdata:Locale=" en-GB">
    <xsd:complexTyp e>
    <xsd:choice maxOccurs="unbo unded">
    <xsd:element name="CD">
    <xsd:complexTyp e>
    <xsd:sequence >
    <xsd:element name="ID" type="xsd:integ er" minOccurs="0" />
    <xsd:element name="DevID" type="xsd:integ er" minOccurs="0" />
    <xsd:element name="PosID" type="xsd:integ er" minOccurs="0" />
    <xsd:element name="Title" type="xsd:strin g" minOccurs="0" />
    </xsd:sequence>
    </xsd:complexType >
    </xsd:element>
    <xsd:element name="Art">
    <xsd:complexTyp e>
    <xsd:sequence >
    <xsd:element name="ID" type="xsd:integ er" minOccurs="0" />
    <xsd:element name="CDID" type="xsd:integ er" minOccurs="0" />
    <xsd:element name="Data" type="xsd:strin g" minOccurs="0" />
    </xsd:sequence>
    </xsd:complexType >
    </xsd:element>
    </xsd:choice>
    </xsd:complexType >
    <xsd:key name="CDSKey1" msdata:PrimaryK ey="true">
    <xsd:selector xpath=".//CD" />
    <xsd:field xpath="ID" />
    </xsd:key>
    <xsd:key name="CDSKey2" msdata:PrimaryK ey="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>
  • Henry S. Thompson

    #2
    Re: constraint not declared

    bartverstraete7 7@hotmail.com (Bart V) writes:
    [color=blue]
    > 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="u rn:schemas-microsoft-com:xml-msdata">[/color]
    .. . .[color=blue]
    > <xsd:keyref name="CDArt" refer="CDSKey1" >
    > <xsd:selector xpath=".//Art" />
    > <xsd:field xpath="CDID" />
    > </xsd:keyref>[/color]


    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="CDLi b" to your xsd:schema element, and change your
    xsd:keyref to say refer="cdl:CDSK ey1"

    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]

    Comment

    • Bart V

      #3
      Re: constraint not declared

      Henry S. Thompson wrote:[color=blue]
      > bartverstraete7 7@hotmail.com (Bart V) writes:
      >
      >[color=green]
      >>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="ht tp://www.w3.org/2001/XMLSchema"
      >> xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">[/color]
      >
      > . . .
      >[color=green]
      >> <xsd:keyref name="CDArt" refer="CDSKey1" >
      >> <xsd:selector xpath=".//Art" />
      >> <xsd:field xpath="CDID" />
      >> </xsd:keyref>[/color]
      >
      >
      >
      > 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="CDLi b" to your xsd:schema element, and change your
      > xsd:keyref to say refer="cdl:CDSK ey1"
      >
      > You will also need to change all your XPaths to use this prefix as
      > well, or none of them will match.
      >
      > ht[/color]
      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="u rn:schemas-microsoft-com:xml-msdata" xmlns:cdl="CDLi b">
      <xsd:element name="CDS" msdata:IsDataSe t="true" msdata:Locale=" en-GB">
      <xsd:complexTyp e>
      <xsd:choice maxOccurs="unbo unded">
      <xsd:element name="CD">
      <xsd:complexTyp e>
      <xsd:sequence >
      <xsd:element name="ID" type="xsd:integ er" minOccurs="0" />
      <xsd:element name="DevID" type="xsd:integ er" minOccurs="0" />
      <xsd:element name="PosID" type="xsd:integ er" minOccurs="0" />
      <xsd:element name="Title" type="xsd:strin g" minOccurs="0" />
      </xsd:sequence>
      </xsd:complexType >
      </xsd:element>
      <xsd:element name="Art">
      <xsd:complexTyp e>
      <xsd:sequence >
      <xsd:element name="ID" type="xsd:integ er" minOccurs="0" />
      <xsd:element name="CDID" type="xsd:integ er" minOccurs="0" />
      <xsd:element name="Data" type="xsd:strin g" minOccurs="0" />
      </xsd:sequence>
      </xsd:complexType >
      </xsd:element>
      </xsd:choice>
      </xsd:complexType >
      <xsd:key name="CDSKey1" msdata:PrimaryK ey="true">
      <xsd:selector xpath=".//CD" />
      <xsd:field xpath="ID" />
      </xsd:key>
      <xsd:key name="CDSKey2" msdata:PrimaryK ey="true">
      <xsd:selector xpath=".//Art" />
      <xsd:field xpath="ID" />
      </xsd:key>
      <xsd:keyref name="CDArt" refer="cdl:CDSK ey1">
      <xsd:selector xpath=".//Art" />
      <xsd:field xpath="CDID" />
      </xsd:keyref>
      </xsd:element>
      </xsd:schema>

      Comment

      • Bart V

        #4
        Re: constraint not declared

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

        grtz Bart

        Comment

        Working...