Adding an import Component to an XML Schema File
See Also
You use an import to add multiple schemas with different target namespace to your XML schema file.
- If you want to add a schema from outside your current IDE project, you must define a project reference before you add the import component. See Working With Project References for details.
To add an import component:
- In the IDE, open the schema file where you want to reference an external schema.
- In the Schema view, select the root node, right-click and choose Add > Import.
-or-
In the Schema view, select the Referenced Schemas node, right-click and choose Add > Import.
The Add Import dialog box opens.
- In the File column, expand the By File or By Namespace nodes to navigate to and select the files you want to reference.
- If you defined project references to other projects, those projects and their files are included in the column. The files that you cannot select are shown as strikeout text (
entry). You cannot select these files for one or more of the following reasons:
- The schema file is already referenced in your source schema file.
- The schema file cannot reference itself, meaning, the file is the source schema file.
For each file you select, the Import checkbox next to your selection is selected and the Namespace field at the bottom of the dialog box is filled in by the IDE, unless you selected a schema file with no target namespace.
- (Optional) To change the prefix used to identify a selected schema, enter a new value in the Prefix column.
- Click OK.
The IDE adds an import node under the Referenced Schemas node with the information about the referenced schema.
- Click the Source button to navigate to the Source view.
The IDE has updated the schema component to include a xmlns attribute for each schema you referenced. In addition, the IDE has added an import component for each referenced schema to your schema file.
- See Also
- Add Import Dialog Box
- Referencing External Schemas
- About Cross-Project XML File References
- About XML Schema Tools
Legal Notices