Jump to: navigation, search


Revision as of 09:43, 27 October 2010 by Kissaki.gmx.de (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

What's required to load a UML (.uml) resource from a standalone application?

That’s a lot of code. Isn’t the following enough?

ResourceSet resS = new ResourceSetImpl();
resS.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", XMI2UMLResource.Factory.INSTANCE);

I was able to use it via:

Resource resource = resS.getResource(URI.createFileURI("/path/to/file.xmi"), true);
if (resource instanceof XMI2UMLResourceImpl) {
  XMI2UMLResource res = (XMI2UMLResource) resource;
  logger.info("XMI version (not file?): {}", res.getXMIVersion());
  EList<EObject> list = res.getContents();

I don’t get what those other things are for. URIConverter? --Kissaki 14:43, 27 October 2010 (UTC)