∟Importing Declarations Across Namespaces - "import" Component
This section describes how to import declarations from other schema documents under other namespaces using import components.
Earlier in this chapter, we learned how to use the "include" component to merge element declarations and
type definitions from old schema documents into new schema documents.
The "include" component only works if both old and new schema documents are having no same namespace or having
the same namespace.
If element declarations or type definitions needs merged or referenced across different namespaces,
we need to use the "import" component, which has the following basic rules:
Rule 1. The XML representation of an "import" component is an "import" element.
Rule 2. The "import" element must have the "namespace" attribute to specify
the target namespace of the schema document to be imported.
Rule 3. The "import" element may have the "schemaLocation" attribute to specify
where to fetch the schema document to be imported.
Rule 4. The imported namespace must be declared in the schema root with a prefix using "xmlns:xx="import-namespace"".
Rule 5. To use (or refer to) an element declaration from the imported schema, the "ref" attribute must be
used on the element component.
In order to practice the "import" component, let's write a simple schema document, xhtml.xsd, assigned to
the target namespace of "http://www.w3.org/1999/xhtml":