Customizing by Using XML Complex Type Restriction
XML schema syntax supports the restriction of complex types that can be used to:
- Eliminate optional attributes or associations
- Set optional attributes or associations to mandatory
To illustrate this capability, consider an interchange that carries a final high school student academic record that includes a class-ranking element. If no customizations were required, this graduation interchange schema would be constructed as follows:
The base, unmodified Ed-Fi Schema for ClassRanking is shown below:
XML Schema listing for ClassRanking
For this example, customize ClassRanking and StudentAcademicRecord as follows:
- Remove the optional element ClassRankingDate.
- Change the optional element PercentageRanking to be mandatory.
- Remove the optional element ClassRanking.
To accomplish this, take the followings steps:
- Use the base EXTENSION-Ed-Fi-Extended-Core.xsd, which includes the schema Ed-Fi-Core.xsd, to create the required extensions.
- Create a new complex type EXTENSION-ClassRankingRestriction.
- Note: The EXTENSION- prefix is a convention used in the Ed-Fi Extension Framework to denote custom type definitions.
- Define the EXTENSION-ClassRankingRestriction to be a restriction with a base of ClassRanking, as defined in the Ed-Fi-Core.xsd.
- Within the restriction, define a sequence and restate the elements that exactly match those defined in ClassRanking and in the same order, with the exception of:
- Omit the minOccurs="0" in the definition of PercentageRanking.
- Omit the element for ClassRankingDate.
- Define an EXTENSION-StudentAcademicRecordRestriction to be a restriction with base of StudentAcademicRecord, as defined in Ed-Fi-Core.xsd
- Within the restriction, define a sequence and restate the elements that exactly match those defined in StudentAcademicRecord and in the same order, with the exception of omitting the ClassRanking element
The following is the resulting schema with annotations removed for brevity:
Developers' Guide Documentation Contents
Find out more about how to develop solutions based on the Ed-Fi Data Standard v2.2: