Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Modeling XSD

You can model XML schemas at two levels, using UML Class diagrams that:

  • Have no XML schema-specific implementation details, to be generated directly by Enterprise Architect's Schema Generator; the generator applies a set of default mappings to convert the abstract model Package to a W3C XML Schema (XSD) file
  • Are refined with XML schema-specific definitions using the 'XML Schema' pages of the Diagram Toolbox, which provides the structures of the UML profile for XSD

Model an XML Schema

Step

Action

See also

1

In the Browser window, create the top-level project structure you need (Model and Views), and click on the appropriate View.

Building Models Views

2

Click on the 'New Package' option in the Browser window header drop-down menu. The 'New Model Package' dialog displays.

Browser Header Bar

3

In the 'Name' field type the name of the new Package, and select the 'Create diagram' radio button.

Click on the OK button. The 'New Diagram' dialog displays.

Add a Package

4

In the 'Name' field type the name of the new diagram.

In the 'Select From' panel select 'UML Structural', and in the 'Diagram Types' panel select 'Class'.

Add New Diagrams

5

Click on the OK button. In the Browser window, double-click on the icon next to the new diagram's name; the diagram opens in the Diagram View, with the 'Class' pages displaying in the Diagram Toolbox.

At this point you can either:

  • Create a Class diagram using the Class Toolbox icons, or
  • Create a tailored XML Schema diagram using the 'XML Schema' pages of the Diagram Toolbox (continue to step 6)
Diagram Toolbox Class Toolbox XML from Abstract Class Models

6

Click on Search to display the 'Find Toolbox Item' dialog and specify 'XML Schema' to display the 'XML Schema' Toolbox pages.

XML Schema Toolbox

7

Click on the 'Schema' icon from the Toolbox and drag it into the Class diagram.

The 'XSD schema Properties' dialog displays.

Complete this dialog, and click on the OK button.

The 'New Diagram' dialog displays.

Schema Package

8

Again, in the 'Name' field type the name of the new diagram.

In the 'Select From' panel select 'UML Structural', and in the 'Diagram Types' panel select 'Class'.

Click on the OK button.

9

An XSDschema stereotyped Package is created in the Browser window and on the diagram, with a child Class diagram.

Double-click on the Package on the diagram to open the child Class diagram, and use the constructs from the XML Schema Toolbox to model the XML Schema.

Global Element Local Element Global Attribute Local Attribute Attribute Group Complex Type Model Group Group Simple Type Union Enumeration Any Any Attribute

Notes

  • The UML attributes of the Classes map directly to XML elements or attributes
  • If you have modeled your XSD Schema as a straight Class diagram, you can define and generate schema from it using the Schema Composer
  • Classes in an XML Schema model have no methods since there is no meaningful correspondence between Class methods and XSD constructs
  • Modeling Restrictions - these XML Schema constructs cannot be modeled in Enterprise Architect:
         -  appinfo
         -  field
         -  key
         -  keyref
         -  notation
         -  redefine
         -  selector
         -  substitutionGroup
         -  unique

Learn more