Local element definitions

It is not necessary to define an element in one place, then refer to this definition in the content model of another element definition. When the element concerned is only used within the model of one other element, it is more efficient to simply define the sub-element in situ within the model of the outer element. The embedded element definition uses the Name attribute instead of the Ref attribute. Sub-elements of these inserted definitions can also be defined locally. In the following example, the Book element definition includes the Chapter element definition, and the Chapter element in turn defines the Paragraph element:

<element name="book">
  <!-- BOOK DEFINITION --> <complexType> <sequence> <element ref="DOC:title" ...

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.