|XML Schemas: Best Practices||Default Namespace - targetNamespace or XMLSchema?||Hide (Localize) Versus Expose||Global versus Local|
|Zero, One, or Many Namespaces||Variable Content Containers||Creating Extensible Content Models||Extending XML Schemas|
Example. If you canít decide whether to make Warranty an element or a type, then make it a type:If you decide later that you need a Warranty element, you can create one using the Warranty type: Recall that elements and types are in different Symbol Spaces. Hence, you can have an element and type with the same name.
 If the item is not intended to be an element in instance documents then define it as a type.
Example. If you will never see this in an instance document:then define Warranty as a complexType.
 If the itemís content is to be reused by other items then define it as a type.
Example. If other items need to use Warranty's content, then define Warranty as a type:The example shows two elements - PromissoryNote and AutoCertificate - reusing the Warranty type.
 If the item is intended to be used as an element in instance documents, and itís required that sometimes it be nillable and other times not, then it must be defined it as a type.
Example. Letís first see how not to do it. Suppose that we create a Warranty element:The Warranty element can be reused elsewhere by refíing it: Suppose that we also need a version of Warranty that supports a nil value. You might be tempted to do this: This is not legal. This dynamic morphing capability (i.e., reusing a Warranty element declaration while simultaneously adding nillability) cannot be achieved using elements. The reason for this is that the ref and nillable attributes are mutually exclusive - you can use ref, or you can use nillable, but not both. The only way to accomplish the dynamic morphing capability is by defining Warranty as a type: and then reusing the type: In the first case Warranty is nillable. In the second case itís not nillable.
 If the item is intended to be used as an element in instance documents and other elements are to be allowed to substitute for the element, then it must be declared as an element.
Example. Suppose that we would like to enable instance document authors to use interchangeably the vocabulary (i.e., tag name) Warranty, Guarantee, or Promise, i.e.,To enable this substitutable-tag-name capability, Warranty, Guarantee, and Promise must be declared as elements, and made members of a substitutionGroup: