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. |
Models Model 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 . 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 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. . In the At this point you can either:
|
Diagram Toolbox Class Toolbox XML from Abstract Class Models |
6 |
Click on 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 . 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 . |
|
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