3

Enterprise Architect 8 によってエクスポートされた mof ベースの xmi ファイルをインポート/ロードしたいと考えています。

 ResourceSet resourceSet_xmi = new ResourceSetImpl();
resourceSet_xmi.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new EMOFResourceFactoryImpl());

File file = new File(fileName);
URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()) : URI.createURI("D:\\Documents and Settings\\broehl_w\\My Documents\\test.xmi");

try {
  // Demand load resource for this file.
  //
  Resource resource = resourceSet_xmi.getResource(uri, true);
  System.out.println("Loaded " + uri);
  resource.save(System.out, null);
}
catch (Exception exception) {
  System.out.println("Problem loading " + uri);
  exception.printStackTrace();
}

しかし、それは例外で終わります:

 org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'null' not found.

実際の XMI ファイル (expoerted) に uri が含まれていないことを確認します。

私はこれを手動で行う必要がありますが、どの uri ですか?

前もって感謝します!

4

0 に答える 0