ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new Bpmn2ResourceFactoryImpl());
resourceSet.getPackageRegistry().put("http://www.omg.org/spec/BPMN/20100524/MODEL", Bpmn2Package.eINSTANCE);
Resource resource = resourceSet.createResource(URI.createURI("inputStream://dummyUriWithValidSuffix.xml"));
InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
resource.load(is, Collections.EMPTY_MAP);
resource.load(Collections.EMPTY_MAP);
return ((DocumentRoot) resource.getContents().get(0)).getDefinitions();
} catch (Throwable t) {