How To: Extend the Ed-Fi XML Schema (Part 3)

This section describes how to customize the Ed-Fi XSD by adding new complex types.

Customizing by Adding New XML Complex Types

New complex types may be added for domain entities or associations when the data model must be extended for new kinds of information.

Extend the Graduation Model

For this example, we will create an extension to the graduation model to reflect basic information about the postsecondary institution(s) that the student is attending. The extended elements are in gray in the model diagram below:

Building upon the example from Part 2, it is possible to create a new complex element to capture the postsecondary institution information. To accomplish this, the following steps are taken:

  1. Define a descriptor named EXTENSION-InstitutionControlDescriptor. We will provide the following values for the descriptor when implemented:
    • Public
    • PrivateNonProfit
    • PrivateForProfit
  2. Define a descriptor named EXTENSION-InstitutionLevelDescriptor. We will provide the following values for the descriptor when implemented:
    • Four Year
    • Two To Four Year
    • Less Than Two Year
  3. Define a new complex type EXTENSION-PostsecondaryInstitution.
  4. Within the EXTENSION-PostsecondaryInstitution type, add a sequence and define the following new elements:
    1. NameOfInstitution of type NameOfInstitution
    2. InstitutionLevel of type EXTENSION-InstitutionLevelDescriptorReferenceType
    3. InstitutionControl of type EXTENSION-InstitutionControlDescriptorReferenceType
    4. AcceptanceIndicator of type xs:boolean
  5. Define a new complex type EXTENSION-PostsecondaryInstitutionIdentityType. This will contain the identifying properties of the new entity.
  6. Within the EXTENSION-PostsecondaryInstitutionIdentityType, add a sequence and define the following elements:
    1. NameOfInstitution of type NameOfInstitution
    2. InstitutionLevel of type EXTENSION-InstitutionLevelDescriptorReferenceType
  7. Define a new complex type EXTENSION-PostsecondaryInstitutionReferenceType based on type ReferenceType.
  8. Within the EXTENSION-PostsecondaryInstitutionReferenceType, add a sequence and define the following element:
    1. PostsecondaryInstitutionIdentity of type EXTENSION-PostsecondaryInstitutionIdentityType, minOccurs="0"
  9. Within the EXTENSION-StudentAcademicRecordExtension, define a new element PostsecondaryInstitutionReference of type EXTENSION-PostsecondaryInstitutionReferenceType.

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" xmlns:ann="http://ed-fi.org/annotation" targetNamespace="http://ed-fi.org/0210" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:include schemaLocation="Ed-Fi-Core.xsd"/>
  <xs:annotation>
    <xs:documentation>===== Ed-Fi 2.1 Extensions =====</xs:documentation>
  </xs:annotation>
  <xs:annotation>
    <xs:documentation>===== Domain Entities =====</xs:documentation>
  </xs:annotation>
  <xs:complexType name="EXTENSION-PostsecondaryInstitution">
    <xs:complexContent>
      <xs:extension base="ComplexObjectType">
        <xs:sequence>
          <xs:element name="NameOfInstitution" type="NameOfInstitution"/>
          <xs:element name="InstitutionLevel" type="EXTENSION-InstitutionLevelDescriptorReferenceType"/>
          <xs:element name="InstitutionControl" type="EXTENSION-InstitutionControlDescriptorReferenceType"/>
          <xs:element name="AcceptanceIndicator" type="xs:boolean"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-StudentAcademicRecordExtension">
    <xs:complexContent>
      <xs:extension base="EXTENSION-StudentAcademicRecordRestriction">
        <xs:sequence>
          <xs:element name="ClassRanking" type="EXTENSION-ClassRankingExtension" minOccurs="0"/>
          <xs:element name="SubmissionCertification" type="EXTENSION-SubmissionCertificationDescriptorReferenceType"/>
          <xs:element name="PostsecondaryInstitutionReference" type="EXTENSION-PostsecondaryInstitutionReferenceType"/>
        </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>===== Descriptors =====</xs:documentation>
  </xs:annotation>
  <xs:complexType name="EXTENSION-InstitutionControlDescriptor">
    <xs:complexContent>
      <xs:extension base="DescriptorType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-InstitutionLevelDescriptor">
    <xs:complexContent>
      <xs:extension base="DescriptorType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-SpecialEducationGraduationStatusDescriptor">
    <xs:complexContent>
      <xs:extension base="DescriptorType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-SubmissionCertificationDescriptor">
    <xs:complexContent>
      <xs:extension base="DescriptorType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:annotation>
    <xs:documentation>===== Extended Reference Types =====</xs:documentation>
  </xs:annotation>
  <xs:complexType name="EXTENSION-PostsecondaryInstitutionIdentityType">
    <xs:sequence>
      <xs:element name="NameOfInstitution" type="NameOfInstitution"/>
      <xs:element name="InstitutionLevel" type="EXTENSION-InstitutionLevelDescriptorReferenceType"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EXTENSION-PostsecondaryInstitutionReferenceType">
    <xs:complexContent>
      <xs:extension base="ReferenceType">
        <xs:sequence>
          <xs:element name="PostsecondaryInstitutionIdentity" type="EXTENSION-PostsecondaryInstitutionIdentityType" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:annotation>
    <xs:documentation>===== Extended Descriptor Reference Types =====</xs:documentation>
  </xs:annotation>
  <xs:complexType name="EXTENSION-InstitutionControlDescriptorReferenceType">
    <xs:complexContent>
      <xs:extension base="DescriptorReferenceType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-InstitutionLevelDescriptorReferenceType">
    <xs:complexContent>
      <xs:extension base="DescriptorReferenceType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-SpecialEducationGraduationStatusDescriptorReferenceType">
    <xs:complexContent>
      <xs:extension base="DescriptorReferenceType" />
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="EXTENSION-SubmissionCertificationDescriptorReferenceType">
    <xs:complexContent>
      <xs:extension base="DescriptorReferenceType" />
    </xs:complexContent>
  </xs:complexType>
    <xs:documentation>===== Common Types =====</xs:documentation>
  </xs:annotation>
  <xs:complexType name="EXTENSION-ClassRankingExtension">
    <xs:complexContent>
      <xs:extension base="ClassRanking">
        <xs:sequence>
          <xs:element name="SpecialEducationGraduationStatus" type="EXTENSION-SpecialEducationGraduationStatusDescriptorReferenceType" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>