Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » How to add option to ANT atl.saveModel?
How to add option to ANT atl.saveModel? [message #895559] Fri, 13 July 2012 14:21 Go to next message
Stefan Kuhn is currently offline Stefan KuhnFriend
Messages: 12
Registered: July 2009
Junior Member
I'm missing a "xsi:schemaLocation= (...)" in my ATL output file. I've
tried to add to the metamodel an
"" annotation with key
"schemaLocation" and value (...). This works for dynamic instances but
not for ATL. So I've digged into ATL and basically found, that the
EMFExtractor of the SaveModelTask is missing the option
"SCHEMA_LOCATION" -> true. Adding this to the ATL Plugin method
saveModels works:

IExtractor extractor = new EMFExtractor();
Map<String, Object> options = new HashMap<String, Object>();
options.put("SCHEMA_LOCATION", true);
extractor.extract(outModel, outModelPath, options);
instead of
extractor.extract(outModel, outModelPath);

But for the ANT task following code doesn't:

<atl.saveModel model="OutModel" path="${OutPath}" derived="true" >
<extractor name="EMF">
<param name="SCHEMA_LOCATION" value="true"/>

Re: How to add option to ANT atl.saveModel? [message #898446 is a reply to message #895559] Thu, 26 July 2012 11:58 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Stefan,
The best place to put the extra XML stuff is in the code generated off the .genmodel then your own Ecore serializer will look after everything when ATL is done.

So I assume you have a DocumentRoot element in the Ecore model. The ATL file must generate a DocumentRoot element. This element must then be used to contain the "real" top element. The DocumentRoot will not be serialised visibly in the XML.

The namespaces can be placed in the auto-generated (generated off your .genmodel) in the createDocumentRoot() method. For example documentRoot.getXMLNSPrefixMap().put("xs",""); and documentRoot.getXSISchemaLocation().put("","myxsd.xsd");

Previous Topic:ATL transformation
Next Topic:Setting a tagged value with refining mode?
Goto Forum:

Current Time: Mon Apr 23 15:52:29 GMT 2018

Powered by FUDForum. Page generated in 0.01764 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software