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
IExtractor extractor = new EMFExtractor();
Map<String, Object> options = new HashMap<String, Object>();
extractor.extract(outModel, outModelPath, options);
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");