Skip to main content



      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 10:21 Go to next message
Eclipse UserFriend
Hi,
I'm missing a "xsi:schemaLocation= (...)" in my ATL output file. I've
tried to add to the metamodel an
"http://www.w3.org/2001/XMLSchema-instance" 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"/>
</extractor>
</atl.saveModel>


why?
Re: How to add option to ANT atl.saveModel? [message #898446 is a reply to message #895559] Thu, 26 July 2012 07:58 Go to previous message
Eclipse UserFriend
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 FactoryImpl.java (generated off your .genmodel) in the createDocumentRoot() method. For example documentRoot.getXMLNSPrefixMap().put("xs","http://www.w3.org/2001/XMLSchema"); and documentRoot.getXSISchemaLocation().put("http://myschemauri.com","myxsd.xsd");

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


Current Time: Wed Jul 23 17:10:01 EDT 2025

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

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

Back to the top