Jump to: navigation, search

Talk:MDT/UML2/FAQ

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)