Substitutions

There may be times when a number of alternative elements could be used at a specific location in a document model. Of course, this group of elements could just be referenced in each location that it can be used (achieved using a non-repeating choice group), and the Group or ComplexType elements could even be used to make the relationships more obvious, and to make management of the group easier. However, another technique is available that offers some advantages.

Head element

In any 'substitution group', one element definition is known as the 'head' element. All remaining elements in the group are possible substitutions for this element. The head element is defined in the normal way, and must be a global element (not locally defined ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.