Skip to end of metadata
Go to start of metadata

Customizing by Using XML Complex Type Extension


XML supports the extension of complex types that can be used to add new elements. Building upon the example and continuing from Part 2, we will add the following elements:

  • A new element to ClassRanking to capture graduation information for special education students
  • A new element to StudentAcademicRecord to indicate if the transcript is an official or unoffical submission

To accomplish this, the following steps are taken:

  1. Define an enumeration type for EXTENSION-SpecialEducationGraduationStatusType with the following enumerations:
    • Completion of IEP and Reached Age 22
    • Completion of IEP and Access to Services, Employment, or Education
    • Completion of IEP and Demonstrated Self-Help Skills
  2. Define an enumeration type for EXTENSION-SubmissionCertificationType with the following enumerations:
    • Official
    • Unofficial
  3. Define a new complex type EXTENSION-ClassRankingExtension.
  4. Define the EXTENSION-ClassRankingExtension to be an extension with a base of EXTENSION-ClassRankingRestriction, as defined in Part 1. (Note that if extending a complex type in the Ed-Fi-Core.xsd without restriction, the original type from Ed-Fi-Core.xsd would become the base of the extension.)
  5. Within the EXTENSION-ClassRankingExtension type, add a sequence and define a new optional element for SpecialEducationGraduationStatus of type EXTENSION-SpecialEducationGraduationStatusType.
  6. Define a new complex type EXTENSION-StudentAcademicRecordExtension.
  7. Define the EXTENSION-StudentAcademicRecordExtension to be an extension with a base of EXTENSION-StudentAcademicRecordRestriction (as defined in Part 1).
  8. Within the EXTENSION-StudentAcademicRecordExtension, add a sequence and define the following new elements:
    • For ClassRanking of type EXTENSION-ClassRankingExtension
    • For SubmissionCertification of type EXTENSION-SubmissionCertificationType

The following is the resulting schema with annotations removed for brevity:

<?xml version="1.0" encoding="UTF-8"?>
<!-- (c)2017 Ed-Fi Alliance, LLC. All Rights Reserved. -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://ed-fi.org/0210" targetNamespace="http://ed-fi.org/0210" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:include schemaLocation="Ed-Fi-Core.xsd"/>
	<xs:annotation>
		<xs:documentation>===== Ed-Fi v2.1 Extensions =====</xs:documentation>
	</xs:annotation>
	<xs:annotation>
		<xs:documentation>===== Domain Entities =====</xs:documentation>
	</xs:annotation>
	<xs:complexType name="EXTENSION-StudentAcademicRecordExtension">
		<xs:complexContent>
			<xs:extension base="EXTENSION-StudentAcademicRecordRestriction">
				<xs:sequence>
					<xs:element name="ClassRanking" type="EXTENSION-ClassRankingExtension"/>
					<xs:element name="SubmissionCertification" type="EXTENSION-SubmissionCertificationType"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="EXTENSION-StudentAcademicRecordRestriction">
		<xs:complexContent>
			<xs:restriction base="StudentAcademicRecord">
				<xs:sequence>
					<xs:element name="CumulativeEarnedCredits" type="Credits" minOccurs="0"/>
					<xs:element name="CumulativeAttemptedCredits" type="Credits" minOccurs="0"/>
					<xs:element name="CumulativeGradePointsEarned" type="GPA" minOccurs="0"/>
					<xs:element name="CumulativeGradePointAverage" type="GPA" minOccurs="0"/>
					<xs:element name="GradeValueQualifier" type="GradeValueQualifier" minOccurs="0"/>
					<xs:element name="AcademicHonor" type="AcademicHonor" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="Recognition" type="Recognition" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="ProjectedGraduationDate" type="xs:date" minOccurs="0"/>
					<xs:element name="SessionEarnedCredits" type="Credits" minOccurs="0"/>
					<xs:element name="SessionAttemptedCredits" type="Credits" minOccurs="0"/>
					<xs:element name="SessionGradePointsEarned" type="GPA" minOccurs="0"/>
					<xs:element name="SessionGradePointAverage" type="GPA" minOccurs="0"/>
					<xs:element name="Diploma" type="Diploma" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="StudentReference" type="StudentReferenceType"/>
					<xs:element name="EducationOrganizationReference" type="EducationOrganizationReferenceType"/>
					<xs:element name="SchoolYear" type="SchoolYearType"/>
					<xs:element name="Term" type="TermDescriptorReferenceType"/>
					<xs:element name="ReportCardReference" type="ReportCardReferenceType" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<xs:annotation>
		<xs:documentation>===== Common =====</xs:documentation>
	</xs:annotation>
	<xs:complexType name="EXTENSION-ClassRankingExtension">
		<xs:complexContent>
			<xs:extension base="EXTENSION-ClassRankingRestriction">
				<xs:sequence>
					<xs:element name="SpecialEducationGraduationStatus" type="EXTENSION-SpecialEducationGraduationStatusType"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="EXTENSION-ClassRankingRestriction">
		<xs:complexContent>
			<xs:restriction base="ClassRanking">
				<xs:sequence>
					<xs:element name="ClassRank" type="xs:int"/>
					<xs:element name="TotalNumberInClass" type="xs:int"/>
					<xs:element name="PercentageRanking" type="xs:int"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<xs:annotation>
		<xs:documentation>===== Enumeration =====</xs:documentation>
	</xs:annotation>
	<xs:simpleType name="EXTENSION-SpecialEducationGraduationStatusType">
		<xs:restriction base="xs:token">
			<xs:enumeration value="Completion of IEP and Reached Age 22"/>
			<xs:enumeration value="Completion of IEP and Access to Services, Employment, or Education"/>
			<xs:enumeration value="Completion of IEP and Demonstrated Self-Help Skills"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="EXTENSION-SubmissionCertificationType">
		<xs:restriction base="xs:token">
			<xs:enumeration value="Official"/>
			<xs:enumeration value="Unofficial"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

As seen in this example, deleting an element with restriction and adding an element with extension may be combined to replace an element.

 

Continue

Developers' Guide Documentation Contents

Find out more about how to develop solutions based on the Ed-Fi Data Standard v2.0: