The XML Schema Import facility is used to reverse engineer a W3C XML Schema (XSD) file as a UML Class model. An XSD file is imported into Enterprise Architect as a UML package. To import an XSD file, follow the steps below:
- In the Project Browser, right-click on the package to contain the imported XSD package. The context menu displays.
- Select the Code Engineering | Import XML Schema menu option. The Import XML Schema dialog displays.
- In the Directory field, click on the [ ... ] (Browse) button. The Select XML Schema(s) dialog displays.
- Click on the required input file. To select several individual files, press [Ctrl] as you click on each one. To select a range of files, press [Shift] and click on the first and last file in the range.
- Click on the Open button to return to the Import XML Schema dialog, which now shows the selected files in the Selected File(s) field.
- The Import global elements with "Type" postfix checkbox defaults to unselected to import a global element, and the ComplexType to which it refers, as a single ComplexType Class.
- The Import referenced XML Schema(s) checkbox defaults to selected, to import any other Schema file referenced by the selected input XML Schema file or files.
If an XML Schema file being imported already exists in the model, Enterprise Architect skips importing the file.
- The Create Diagram for XML Schema(s) checkbox defaults to selected, to display the imported elements on the diagram. If necessary, deselect the checkbox.
- For the Import XSD Elements/Attributes as: field, select the appropriate radio button to import elements and attributes in the XML Schema as:
- UML Association connectors or
- UML Class attributes.
- Click on the Import button to import the schema.
- The progress of the schema import is shown in the Progress status bar.
The Import XML Schema dialog can also be accessed for the active diagram by selecting the Project | XML Schema | Import XML Schema menu option.
Enterprise Architect uses the schemaLocation attribute in the Import and Include elements of an XML Schema to determine the dependencies between the files. Ensure that this attribute is set to a valid file path (and not a URL) for the dependent XML Schema(s) to be imported correctly.