Java Reference
In-Depth Information
After
Finish
, you'll see
xhtml.ecore
and
xhtml.genmodel
in the project,
with the genmodel open in the editor. Select the
xhtml
root package and change
the
Base Package
property to
org.w3c
, replacing the
org.w3._1999
derived
from the schema. We use this model only as an example, so we don't spend time
tweaking the remainder of the generation properties or provide much in terms of
implementation enhancement beyond the defaults. If you're interested, you can
take some time to browse the Ecore model that can be initialized from the
schema. If you've seen HTML, the elements and attributes should look familiar.
6.7.2 Creating the mindmap2xhtml QVT
Our QVT implementation lets us work with workspace Ecore models, so there's
no need to generate the XHTML model code yet. When we deploy our
mindmap, however, we will need to do so. For now, we'll create a new
mindmap2xhtml.qvto
file in our
/transformations
folder of the
org.
eclipse.dsl.mindmap
project. When you're finished with this, go to the proj-
ect properties and add the local
xhtml.ecore
file to the
QVT Settings
→
Metamodel Mappings
section so that the editor can resolve the model. Replace
the default transformation content with this starter code:
modeltype
mindmap 'strict'
uses
'http://www.eclipse.org/2008/mindmap';
modeltype
xhtml 'strict'
uses
'http://www.w3.org/1999/xhtml';
transformation
mindmap2xhtml(
in
inModel : mindmap,
out
outModel : xhtml);
main
() {
inModel.rootObjects()[Map]->
map
toXHTML();
}
mapping
mindmap::Map::toXHTML() : xhtml::DocumentRoot {
html +=
object
xhtml::HtmlType {
head :=
object
xhtml::HeadType {
};
_body :=
object
xhtml::BodyType {
};
}
}
So far, so good. Next we discover that there's no way to declare text between
elements such as <p> or <li>, if we add their element type to the body. QVTO
cannot currently deal with statements such as
mixed += 'text';
because
mixed is of type
EFeatureMapEntry
and cannot be set with a string. A
Search WWH ::
Custom Search