Global Types and Local Elements versus Global Elements

In addition to declaring your own types and creating Elements from your types, you may declare Elements and reuse them by way of a reference. An example of the syntax for doing this appears below.

<xs:element ref="Column01" minOccurs="0"/>

Column01 has been defined somewhere else in the schema, based on a type. This style is uncommon because the referenced names must have a scope that is global to the whole namespace used in the schema. As you can imagine, this requires all names to be unique. Ensuring uniqueness can be tedious in large schemas and can lead to some awkward names. It is, however, one way to ensure that names are globally unique and that things that are named the same actually are the same.

The more common practice is to define simple and complex types, which by their nature (with the exception noted in the next subsection) have names that are global in scope. These are then used to define Element names whose scope is only local to the complex type in which they are defined.

You will, however, probably see both approaches.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset