blob: 4aea589c5a6adf03454daa2456dadb6e12dd0dac [file] [log] [blame]
<html>
<head>
<title>Overview</title>
<link href="book.css" rel="stylesheet" type="text/css"/>
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator"/>
<link rel="home" href="index.html" title="Xpand Documentation"/>
<link rel="up" href="xsd_tutorial.html" title="XSD Tutorial"/>
<link rel="prev" href="xsd_tutorial.html" title="XSD Tutorial"/>
<link rel="next" href="xsd_tutorial_create_project.html" title="Step 1: Create a Project"/>
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Overview</h1>
<div class="section" title="Overview">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="xsd_tutorial_overview"/>Overview</h2>
</div>
</div>
</div>
<p>This tutorial explains how you can do code generation with Xtend and
Xpand, using XML Schema Definitions as meta models and XML files as
models. To keep things easy, the introduced example is a minimalistic one.
A text file is generated from contents specified in XML. The general
concept of models, meta models and why and when code generation is useful,
is not explained. At the end, a deeper view under the hood is taken to
understand how XML Schemas are transformed to EMF Ecore models, and which
flexibilities/restrictions this approach provides.</p>
<p>All source files listed within this tutorial are also available as
an example project wich can be imported into the Eclipse workspace by
running <span class="emphasis">
<em>"File" / "New" / "Example..." / "Xpand/Xtend Examples
using an XSD Meta Model" / "M2T custom XML to Text via Xpand (minimal
Example)"</em>
</span>. This will create the project
<code class="classname">org.eclipse.xpand.examples.xsd.m2t.minimal</code> project
in your workspace. This minimal example is based on "<span class="emphasis">
<em>M2T custom
XML to Java via Xpand</em>
</span>"
(<code class="classname">org.eclipse.xpand.examples.xsd.m2t.xml2javawizard</code>)
which is more comprehensive and recommended for further reading.</p>
<p>To generate code from XML files with Xpand, at least files of the
following four types are needed:</p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
<p>Meta Model ( <code class="filename">metamodel.xsd</code> )</p>
</li>
<li class="listitem">
<p>Model ( <code class="filename">model.xml</code> )</p>
</li>
<li class="listitem">
<p>Xpand Template ( <code class="filename">template.xpt</code> )</p>
</li>
<li class="listitem">
<p>MWE Workflow ( <code class="filename">workflow.mwe</code> )</p>
</li>
</ul>
</div>
<div class="figure">
<a name="xsd_tutorial_xsd_project"/>
<p class="title">
<b>Figure 1. Minimalistic Xpand XSD Project</b>
</p>
<div class="figure-contents">
<div class="mediaobject">
<img src="xsd_tutorial/workspace-minidemo.png" alt="Minimalistic Xpand XSD Project"/>
</div>
</div>
</div>
<br class="figure-break"/>
</div>
</body>
</html>