Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Import XMI
Import XMI [message #608661] Fri, 06 July 2007 14:59
Eclipse UserFriend
Originally posted by: kevin.m.meredith.lmco.com

I would like to import XMI to Eclipse, specifically RSA, however this
error appears when attempting to load it via Java code.

Package with uri 'http://schema.omg.org/spec/UML/2.1.1' not found

I believe that the project being created via Java is a Java project, not
the desired UML project.

Please help me to specify that my Java code will specify that a UML model
is to be created.

Here's my code:

/*
* Main.java
*
* Created on July 5, 2007, 3:37 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package loadxmi;
import java.io.File;
import java.io.IOException;
//import java.net.URI;
import org.eclipse.emf.common.util.URI;
import java.util.Collections;
//import org.eclipse.emf.*;
import org.eclipse.emf.ecore.resource.*;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

/**
*
* @author mereditk
*/
public class Main {

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

// Create a resource set.
ResourceSet resourceSet = new ResourceSetImpl();

// Register the default resource factory -- only needed for
stand-alone!

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
Resource.Factory.Registry.DEFAULT_EXTENSION, new
XMIResourceFactoryImpl());

// Register the package -- only needed for stand-alone!
//LibraryPackage libraryPackage = LibraryPackage.eINSTANCE;

// Get the URI of the model file.
//URI fileURI = URI.createFileURI(new File("c:/documents and
settings/mereditk/desktop/jfacc.xmi").getAbsolutePath());
//URI fileURI = URI.createFileURI(new
File("e:/tif/KevinMeredith/Samples/xmi/UPDM
Example.xmi").getAbsolutePath());
URI fileURI = URI.createFileURI(new File("C:/Documents and
Settings/mereditk/Desktop/abc2.xmi").getAbsolutePath());
// Demand load the resource for this file.
Resource resource = resourceSet.getResource(fileURI, true);

// Print the contents of the resource to System.out.
try
{
resource.save(System.out, Collections.EMPTY_MAP);
}
catch (IOException e) {}
}

}
Previous Topic:Live validation as default
Next Topic:[Teneo] Identifier for my objects
Goto Forum:
  


Current Time: Fri Aug 19 12:23:35 GMT 2022

Powered by FUDForum. Page generated in 0.02114 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top