CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

What am I missing ?

I love typed datasets. I love XSD's. Import them into your project and .NET will generate a beautifull class for you. Usually importing datasets is a no-bump matter but there is something wrong with this schema :

<?xml version="1.0" encoding="utf-8" ?>

<xs:schema id="DataSet1" targetNamespace=http://www.testgekko/pp/DataSet1.xsd
xmlns:mstns
=http://www.testgekko/pp/DataSet1.xsd
xmlns=http://www.testgekko/pp/DataSet1.xsd
xmlns:xs
=http://www.w3.org/2001/XMLSchema
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified"

elementFormDefault="qualified">

<xs:element name="DataSet1" msdata:IsDataSet="true" msdata:Locale="nl-NL">
<xs:complexType
>
<xs:choice maxOccurs
="unbounded">
   <xs:element name
="Categories">
   <xs:complexType
>
   <xs:sequence
>
      <xs:element name="CategoryID" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int"
/>
      <xs:element name="CategoryName" type="xs:string"
/>
      <xs:element name="Description" type="xs:string" minOccurs="0"
/>
      <xs:element name="Picture" type="xs:base64Binary" minOccurs="0"
/>
   </xs:sequence
>
   </xs:complexType
>
   </xs:element
>
</xs:choice
>
</xs:complexType>

<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Categories"
/>
<xs:field xpath="mstns:CategoryID"
/>
</xs:unique>

</xs:element>

</xs:schema>

XSD parses the schema without complaining. The app builds. But there are no classes generated. So you can't use the dataset. I've been staring over and over again but I just don't understand what's wrong with the schema. Anybody got a clue ?

Peter

Update : the schema is OK, it is VS: http://dotnetjunkies.com/WebLog/petergekko/archive/2004/03/10/8766.aspx



Comments

Peter van Ooijen said:

tried that allready Thanks.
# March 9, 2004 1:52 PM

JosephCooney said:

Hi Peter

I have a utility I'm writing that can create typed datasets directly from regular 'live' datasets (it infers the schema and then uses the same classes that xsd.exe uses to generate the typed dataset using codedom). It works OK. I can email it to you if you wish - it might help to throw some light on the problems you're having. Send me an email at joseph_cooney (at) hotmail.com if you want me to email it to you.
# March 9, 2004 4:50 PM

Enjoy Every Sandwich said:

You've been Taken Out! Thanks for the good post.
# March 9, 2004 5:42 PM

Peter's Gekko said:

Importing datasets in a VS solution
# March 9, 2004 8:05 PM

Gerrard said:

add quotation marks around the attribute values of the schema element. This isn't HTML!

;)

targetNamespace="http://www.testgekko/pp/DataSet1.xsd"
# April 7, 2004 4:02 PM

Peter said:

# April 8, 2004 2:39 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

This Blog

Syndication

News