public class JexToXmlCopier {
private JexXmlResource copy;
public JexToXmlCopier(Resource original, String extension) {
copy = new JexXmlResource(original.getURI().trimFileExtension().appendFileExtension(extension));
copy.getContents().addAll(EcoreUtil.copyAll(original.getContents()));
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResources().add(copy);
// set up extension
ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(resourceSet.getPackageRegistry());