XSD SchemaLesson 96Free preview
XSD Substitution
This lesson is part of XML · All levels
Summary
Substitution group allows an element to replace another element in a data document, provided that the substitution element refers to the head element via the substitutionGroup attribute. Head can be marked abstract="true" so that it cannot be used directly, so the data must select one of its members. Another alternative uses the xsi:type attribute to replace the type of an element, rather than its name.
Key points
- SubstitutionGroup="nameHead" assigns the element as a substitute member
- The head element must be a global element declared in <xs:schema>
- Abstract="true" prohibits the use of head directly in data documents
- Members must wear a type compatible with the head type.
- Xsi:type replaces the type of element, not substitutionGroup replaces the element
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.