Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to add option to ANT atl.saveModel?
https://www.eclipse.org/forums/index.php/mv/msg/367463/895559/#msg_895559
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);
why?]]>Stefan Kuhn2012-07-13T14:21:39-00:00Re: How to add option to ANT atl.saveModel?
https://www.eclipse.org/forums/index.php/mv/msg/367463/898446/#msg_898446
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");