XML Schema Definition for Class Schedule

explode

New Member
So, I am tasked to write an XML Schema Definition to store my current semester's academic schedule. I am supposed to include my name and class year as well as additional elements for each of my academic classes. I need to enforce rules that I must have at least four classes and no more than eight classes. For each class, I need a designator, the course name, the instructor name, and current overall percentage. I also need to make sure they are all the appropriate data type.My issue seems to lie in putting in part for the name and class year. Currently, I have:\[code\]<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="classSchedule"> <xs:complexType> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="classYear" type="xs:int"/> <xs:sequence minOccurs="4" maxOccurs="8"> <xs:element name="class"> <xs:complexType> <xs:all> <xs:element name="courseDesignator" type="xs:string"/> <xs:element name="courseName" type="xs:string"/> <xs:element name="instructorName" type="xs:string"/> <xs:element name="currentGrade" type="xs:float"/> </xs:all> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema>\[/code\]Right now, I get an error that the \[code\]sequence\[/code\] tag cannot come underneath the \[code\]complexType\[/code\] tag.The name and class year are info about the student, and each student will have between 4 and 8 classes; right now I can't figure out why I am having trouble putting in the name and class year. When I take out the two lines for name and class year, the XSD saves properly without errors.
 
Back
Top