Skip to main content



      Home
Home » Modeling » UML2 » Re: Import XMI
Re: Import XMI [message #622855] Fri, 06 July 2007 11:07
Eclipse UserFriend
Kevin,

Please use the UML2 newsgroup for questions about UML. I've added it to
the "to" list of the reply, so there's no need to repost the question.
I'm pretty sure they have migration documentation that describes how to
do this, so be sure to check out what's available:
http://wiki.eclipse.org/index.php/MDT-UML2



Kevin M wrote:
> 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:How get actual class attributes from uml class
Next Topic:Java Problems
Goto Forum:
  


Current Time: Thu Jul 10 04:42:20 EDT 2025

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

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

Back to the top