Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [ATL] How to change ecoding (How to change the encoding of a transformation xmi file from "ISO-8859-1" to "ASCII")
[ATL] How to change ecoding [message #923322] Tue, 25 September 2012 16:34 Go to previous message
lili Missing name is currently offline lili Missing name
Messages: 6
Registered: July 2011
Junior Member
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!
 
Read Message
Read Message
Read Message
Previous Topic:error
Next Topic:ATL ignores elements inside a UML PackageImport
Goto Forum:
  


Current Time: Wed May 22 18:40:50 EDT 2013

Powered by FUDForum. Page generated in 0.01717 seconds