Model 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 Project Browser, create the top-level project structure you need (Model and Views), and click on the appropriate View.

Models

Views

 

2

Click on the New Package icon in the Project Browser toolbar. The New Model Package dialog displays.

 

Project Browser Toolbar

3

In the Name field type the name of the new package, and select the Automatically add new diagram and Open new diagram checkboxes.

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. The new Class 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 (click on the link to the right), 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 the More tools option in the Toolbox and select Extended | 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 Project Browser 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
Classes in an XML Schema model have no methods since there is no meaningful correspondence between Class methods and XSD constructs
Modeling Restrictions - the following XML Schema constructs cannot be modeled in Enterprise Architect:
appinfo
field
key
keyref
notation
redefine
selector
substitutionGroup
unique

Learn more