Generating an EMF Model using XML Schema

This tutorial provides a step-by-step description for creating an EMF model from an XML schema and then generating a simple model editor for it. Completing this tutorial will enable you to see how easy EMF makes it to go from a simple model definition in an XML schema to a fully-functioning editor for that model.

The XML schema file we use in this tutorial can be found here: library.xsd. Save it somewhere on your workstation for later use.

The mapping rules from XML schema to ECore are:

From a modeling perspective, an XML schema is not as expressive as ECore. An XML schema cannot be used to define bi-directional references, nor can it provide the type of a reference target.

The screenshots are based on version 2.1 of the Eclipse SDK, version 1.1.0 of EMF and version 1.1.0 of XSD.

Contents

Step 0: Prerequisites
Step 1: Importing the Model from an XML Schema
Step 2: Generating the EMF Model Code
Step 3: Generating an Editor for the Model
Step 4: Running the Generated Editor


Next: Prerequisites