Loading EMF XSD Models at Runtime
I wanted to be able to get the XSDSimpleTypeDefinition of a particular defined XSD type in my Eclipse plugin environment, i.e.
http://openiaml.org/model/datatypes#iamlInteger
Which was stored in an XSD file
org.openiaml.model/model/datatypes.xsd
The solution is to load the XSD file (through a URI) at runtime using EMF, and then iterating through this file to find the relevant data types. These can then be saved and referred to as necessary.
URI uri = URI.createURI("platform:/plugin/org.openiaml.model/model/datatypes.xsd");
EObject root = ModelLoader.load(uri);
XSDSchema schema = (XSDSchema) root;
for (XSDTypeDefinition type : schema.getTypeDefinitions()) {
// ... checks with getURI()
}