Hello,
Can anyone please help me to understand why when I use one XSD file to
create a DataSet.cs file it gives me a much longer file with more cs
code which allows Typing for all my elements and another which has the
same keys but has an additional level of nest which produces a much
smaller DataSet.cs file
using command line xsd test.xml /d
Here are the 2 xsd files...thanks
if not perhaps any books or links to good detailed (not examples in a
vacuum) explainations of the use of XSD, Typed DataSets in Visual
Studio.net
this give full typed support
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Test" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Test" msdata:IsDataSet="true"
msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Question">
<xs:complexType>
<xs:sequence>
<xs:element name="Option" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Text" type="xs:string" />
<xs:attribute name="Selected" type="xs:string" />
<xs:attribute name="Tooltip" type="xs:string" />
<xs:attribute name="Answer" type="xs:string" />
<xs:attribute name="question_id" type="xs:short"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:short" use="required" />
<xs:attribute name="section_id" type="xs:short" use="required"
/>
<xs:attribute name="Text" type="xs:string" use="required" />
<xs:attribute name="Type" type="xs:string" use="required" />
<xs:attribute name="Score" type="xs:string" default="0" />
<xs:attribute name="Mandatory" type="xs:string" default="false"
/>
<xs:attribute name="Tooltip" type="xs:string" use="optional" />
<xs:attribute name="MultiSelect" type="xs:string" use="optional"
/>
<xs:attribute name="AllowNoSelection" type="xs:string"
use="optional" />
<xs:attribute name="Multiline" type="xs:string" use="optional"
/>
<xs:attribute name="MaxLength" type="xs:string" use="optional"
/>
<xs:attribute name="MinLength" type="xs:string" use="optional"
/>
<xs:attribute name="InitialValue" type="xs:string"
use="optional" />
<xs:attribute name="Validation" type="xs:string" use="optional"
/>
<xs:attribute name="Answer" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="QuestionKey2" msdata:PrimaryKey="true">
<xs:selector xpath="Question" />
<xs:field xpath="@id" />
</xs:key>
</xs:element>
</xs:schema>
this does not why?
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="test2" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="TestSection" msdata:IsDataSet="true"
msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Section" minOccurs="0" maxOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Question" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Option" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Text" type="xs:string" />
<xs:attribute name="Selected" type="xs:string" />
<xs:attribute name="Tooltip" type="xs:string" />
<xs:attribute name="Answer" type="xs:string" />
<xs:attribute name="question_id" type="xs:short"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="Text" type="xs:string" />
<xs:attribute name="Type" type="xs:string" />
<xs:attribute name="Score" type="xs:string" />
<xs:attribute name="Mandatory" type="xs:string" />
<xs:attribute name="Tooltip" type="xs:string" />
<xs:attribute name="MultiSelect" type="xs:string" />
<xs:attribute name="AllowNoSelection" type="xs:string" />
<xs:attribute name="Multiline" type="xs:string" />
<xs:attribute name="MaxLength" type="xs:string" />
<xs:attribute name="MinLength" type="xs:string" />
<xs:attribute name="InitialValue" type="xs:string" />
<xs:attribute name="Validation" type="xs:string" />
<xs:attribute name="Answer" type="xs:string" />
<xs:attribute name="section_id" type="xs:short"
use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="NumberOfQuestions" type="xs:string" />
<xs:attribute name="Type" type="xs:string" />
<xs:attribute name="Score" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="TestSectionKey1">
<xs:selector xpath=".//Section" />
<xs:field xpath="@id" />
</xs:key>
<xs:key name="TestSectionKey2">
<xs:selector xpath=".//Question" />
<xs:field xpath="@id" />
</xs:key>
<xs:keyref name="SectionQuestion" refer="TestSectionKey1"
msdata:ConstraintOnly="true">
<xs:selector xpath=".//Question" />
<xs:field xpath="@section_id" />
</xs:keyref>
<xs:keyref name="QuestionOption" refer="TestSectionKey2"
msdata:ConstraintOnly="true">
<xs:selector xpath=".//Option" />
<xs:field xpath="@question_id" />
</xs:keyref>
</xs:element>
</xs:schema>