Problems loading XSD in standalone transformation [message #1751492] |
Tue, 10 January 2017 18:34 |
Aubrey Mising name Messages: 6 Registered: January 2010 |
Junior Member |
|
|
Hi,
I am working in an standalone transformation that uses as input an XML backed with an XMLSchema. My code is based on "org.eclipse.epsilon.eunit.examples.etl", so my models and metamodels are placed in a source code folder with the packages models and metamodels.
I have tried several things with no success.
Attempt 1:
I copy this section of code of the thread [1]:
StringProperties sp = new StringProperties();
sp.put(XmlModel.PROPERTY_NAME, name);
sp.put(XmlModel.PROPERTY_READONLOAD, readOnLoad);
sp.put(XmlModel.PROPERTY_STOREONDISPOSAL, storeOnDisposal);
sp.put(XmlModel.PROPERTY_XSD_FILE,getResourceEmfURI(metamodelPath).toFileString());
sp.put(XmlModel.PROPERTY_MODEL_FILE,getResourceEmfURI(modelPath).toFileString());
xmlModel.load(sp, (IRelativePathResolver)null);
The code of the method getResourceEmfURI is:
private URI getResourceEmfURI(String resourcePath) {
URI res=URI.createURI(getClass().getResource(
RESOURCE_PATH_PREFIX + resourcePath).toExternalForm());
System.out.println(res.toFileString());
return res;
}
and I got the following exception:
java.lang.NullPointerException
at org.eclipse.epsilon.emc.emf.xml.XmlModel.load(XmlModel.java:40)
at org.eclipse.opencert.epfimport.standalone.EPFTransformation.loadXMLModel(EPFTransformation.java:46)
at org.eclipse.opencert.epfimport.standalone.RunTransformation.main(RunTransformation.java:11)
which is caused by the fact that the IRelativePathResolver is null. However, I do not know about any implementation of this interface.
Attempt 2
My second attempt has been directly inspired by the standalone examples of the mentioned example and it is as follows:
xmlModel.setName(name);
xmlModel.setMetamodelFileUri(getResourceEmfURI(metamodelPath));
xmlModel.setModelFileUri(getResourceEmfURI(modelPath));
xmlModel.setReadOnLoad(readOnLoad);
xmlModel.setStoredOnDisposal(storeOnDisposal);
xmlModel.load();
and I got the following exception:
Internal error: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Class 'schema' is not found or is abstract. [file:/G:/*****/bin/metamodels/EPFSchema.xsd, 3, 162]
Do you have any idea about how to resolve this?
[1]http://www.eclipse.org/forums/index.php?t=msg&&th=153856&goto=484564
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01502 seconds