Hello,
I'm facing a problem and a googled to find a solution, but couldn't solve. I have an ATL transformation that generate a file, after that i'm trying to use this file on my application, but i was facing a org.eclipse.emf.ecore.xmi.FeatureNotFoundException. So i made some tests and i think my problem is related to the encoding of ATL generated file.
Im trying to import the ATL generated tha is something like this:
[code]
<?xml version="1.0" encoding="ISO-8859-1"?>
<a:A xmi:version="2.0" xmlns:xmi="http: //www .omg.org/XMI" xmlns:a="http: // a/1.0">
<event msg="Teste"/>
</a:A>
With this i get org.eclipse.emf.ecore.xmi.FeatureNotFoundException
But if i export a file from my app (not ATL transformed) i have thi:
<?xml version="1.0" encoding="ASCII"?>
<a:A xmi:version="2.0" xmlns:xmi="http : //www .omg.org/XMI" xmlns:a="http : // a/1.0">
<event msg="Teste"/>
</a:A>
For this last one i used the simple resource saving...
APackage.eINSTANCE.eClass();
// Retrieve the default factory singleton
AFactory factory = AFactory.eINSTANCE;
// Create the content of the model via this program
A ap = factory.createA();
Event ev = factory.createEvent();
ev.setMsg("Teste");
ap.setEvent(ev);
// Register the XMI resource factory for the .a extension
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("a", new XMIResourceFactoryImpl());
// Obtain a new resource set
ResourceSet resSet = new ResourceSetImpl();
// Create a resource
Resource resource = resSet.createResource(URI
.createURI("teste.a"));
resource.getContents().add(ap);
// Now save the content.
try {
resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
e.printStackTrace();
}
And with the last one the same code to import works fine...So i thik the problem is the codification of the file.
How to solve encoding incompatibility problems? Is that a way of changing the default encoding on ATL or on the resource saving?
Thanks!