I created the following schema to validate my xml document:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="idType">
<xs:restriction base="xs:ID">
<xs:pattern value="IT\d{2}-\d{3}-\d{3}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="codeType">
<xs:restriction base="xs:string">
<xs:enumeration value="MP"/>
<xs:enumeration value="SP"/>
<xs:enumeration value="WPA"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="degrees">
<xs:complexType>
<xs:sequence>
<xs:element name="degree" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:attribute name="degreeID" type="idType"/>
<xs:attribute name="degreeCode" type="codeType"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="approvalDate" type="xs:date"/>
<xs:element name="effectiveDate" type="xs:date"/>
<xs:element name="summary" type="xs:string"/>
<xs:element name="coordinator" type="xs:string"/>
<xs:element name="comment">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="date" type="xs:date" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="degree">
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="approvalDate" minOccurs="0" maxOccurs="1"/>
<xs:element ref="effectiveDate"/>
<xs:element ref="summary"/>
<xs:element ref="coordinator"/>
<xs:element ref="comment" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="degreeID" use="required"/>
<xs:attribute name="degreeCode" use="required"/>
</xs:complexType>
</xs:element>
key to the requirement is the sequence which I believe requires the elements to be in that order and that each element occur one time unless otherwise noted.
My schema and XML are well formed and the XML (below) validates against the schema per XMLSpy.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<degrees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="degrees.xsd">
<degree degreeID="IT10-152-100" degreeCode="MP">
<title>Information Technology-Mobile Programmer</title>
<approvalDate>2017-01-12</approvalDate>
<effectiveDate>2017-09-01</effectiveDate>
<summary>This two-year program meets the specific skill and knowledge requirements
of technical and professional jobs within the information technology field for
an entry-level mobile programmer working in a small to medium size
organization. Training blends general educational development with required
IT technical skills. Emphasis is in mobile web and application development.
</summary>
<coordinator>Janis Wu</coordinator>
<comment date="2017-01-12">Janis Wu contacted regards heads up on approval. Official paperwork is being sent</comment>
<comment date="2017-01-01">Janis Wu assigned as coordinator</comment>
<comment date="2016-12-01">Application draft submitted</comment>
</degree>
</degrees>
But when I manipulate the XML (add and additional approval or effective date element, add a comment in between the date elements) the XML still validates. But I don't understand why. I know the XSD reference is correct, because if I remove the required date attribute from a comment it does not validate.