I am trying to create an XSD for following schema and I am unsure how to self reference the same type element. I tried using the ref attribute but visual studio keeps on raising an error when i create the xml file. When creating XML inside the pre-req element it is expecting me to provide it a full Course element with description/department/credits
can someone help generate xsd for the xml at the end
<xs:element name="Course">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" />
<xs:element name="Department" />
<xs:element name="Credits" type="xs:decimal" />
<xs:element name="Prerequisite" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="Course" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="CourseCode" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Courses">
<xs:complexType>
<xs:sequence>
<xs:element ref="Course" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
And here is the XML
<Courses>
<Course CourseCode="ABC123">
<Description>This is Math Level 2</Description>
<Department>Maths</Department>
<Credits>7.5</Credits>
<Prerequisite>
<Course CourseCode="MTH001"></Course>
</Prerequisite>
</Course>
<Course CourseCode="MTH001">
<Description>This is Math Level 1</Description>
<Department>Maths</Department>
<Credits>5.0</Credits>
</Course>
</Courses>