I have been using a typed-dataset for some time. I recentlydecided to see if I could port the implementation to be based onan XML flat file. Neither the .xsd that the dataset is generatedfrom nor an .xsd created from the dataset in memory readscleanly. In both cases, I get a "Invalid 'key' node in keyref'error. I've tried several things, but I have no idea where to gonext. Is there something wrong with my .xsd that I'moverlooking?
Attached is the relevant subset of my XSD. The error is reportedin the KeyGalleryImageRef. Any help would be appreciated.
<?xml version="1.0" standalone="yes" ?>
<xs:schema id="PortfolioDataSet"targetNamespace="http://www.tempuri.org/PortfolioDataSet.xsd"xmlns:mstns="http://www.tempuri.org/PortfolioDataSet.xsd"xmlns="http://www.tempuri.org/PortfolioDataSet.xsd"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"attributeFormDefault="qualified"elementForm Default="qualified">
<xs:element name="PortfolioDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="tblImage">
<xs:complexType>
<xs:sequence>
<xs:element name="SetId" type="xs:int" />
<xs:element name="Id" msdata:ReadOnly="true"msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="Name" type="xs:string"minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tblGallery">
<xs:complexType>
<xs:sequence>
<xs:element name="SetId" type="xs:int" />
<xs:element name="Id" msdata:ReadOnly="true"msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="Name" type="xs:string"minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tblGalleryImage">
<xs:complexType>
<xs:sequence>
<xs:element name="SetId" type="xs:int" />
<xs:element name="ImageId" type="xs:int" />
<xs:element name="GalleryId" type="xs:int"/>
<xs:element name="Priority" type="xs:int"minOccurs="0" />
<xs:element name="StatusId" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="KeyImage" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:tblImage" />
<xs:field xpath="mstns:SetId" />
<xs:field xpath="mstns:Id" />
</xs:unique>
<xs:unique name="KeyGallery" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:tblGallery" />
<xs:field xpath="mstns:SetId" />
<xs:field xpath="mstns:Id" />
</xs:unique>
<xs:unique name="KeyGalleryImage"msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:tblGalleryImage" />
<xs:field xpath="mstns:SetId" />
<xs:field xpath="mstns:ImageId" />
<xs:field xpath="mstns:GalleryId" />
</xs:unique>
<xs:keyref name="KeyGalleryImageRef" refer="KeyGallery">
<xs:selector xpath=".//mstns:tblGalleryImage" />
<xs:field xpath="mstns:SetId" />
<xs:field xpath="mstns:GalleryId" />
</xs:keyref>
<xs:keyref name="KeyImageGalleryRef" refer="KeyImage">
<xs:selector xpath=".//mstns:tblGalleryImage" />
<xs:field xpath="mstns:SetId" />
<xs:field xpath="mstns:ImageId" />
</xs:keyref>
</xs:element>
</xs:schema>
--------------------------------
From: Jordan Breckenridges
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>8R/u22jcq0mL4olba9cDgw==</Id>