Hi,
my genmodel contains to ecore-Metamodels (xjustiz.ecore, xdome.ecore). One Reference in metamodel_1 reference on an element in metamodel_2, like:
<XJustiz_Daten xsi:schemaLocation="...xjustiz.de ...osci.de/xjustiz/Archiv/1.3/1.3.2/xj_0500_straf_1_1.xsd" xmlns:ns1="...xdomea.de" xmlns="...xjustiz.de" xmlns:xsi="...w3.org/2001/XMLSchema-instance">
<Grunddaten XJustizVersion="1.3">
<!--..here is some other stuff...-->
<Sendungsdaten>
<XDOMEA XDOMEA_Version="1.0">
<ns1:XDOMEA_Daten>
<ns1:Dokument>
<ns1:Identifizierung>asdasd</ns1:Identifizierung>
</ns1:Dokument>
</ns1:XDOMEA_Daten>
</XDOMEA>
</Sendungsdaten>
</Grunddaten>
</XJustiz_Daten>
The code to read the xml is as follow:
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(XjustizPackage.eNS_URI,XustizPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(XdomeaPackage.eNS_URI,XdomeaPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
new XjustizResourceFactoryImpl());
URI url = URI.createFileURI("text.xml");
Resource resource = resourceSet.getResource(url, true);
resource.getContents().get(0)
When I start the transformation I get the following exception
java.lang.NullPointerException
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2140)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2035)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1814)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1023)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
.....
The causes by the EStructuralFeature.getEType() don't have an EPackage registered.
If I remove the nodes with "<XDOMEA XDOMEA_Version="1.0">" it works fine.
Have somebody an idea what's going wrong?
[Updated on: Wed, 21 March 2012 14:25]
Report message to a moderator