Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Nullpointer XMLHandler#createObjectFromFeatureType - Reference internal a second metamodel
Nullpointer XMLHandler#createObjectFromFeatureType - Reference internal a second metamodel [message #826005] Wed, 21 March 2012 14:24 Go to next message
Sascha Petersen is currently offline Sascha PetersenFriend
Messages: 3
Registered: March 2012
Junior Member
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

Re: Nullpointer XMLHandler#createObjectFromFeatureType - Reference internal a second metamodel [message #826503 is a reply to message #826005] Thu, 22 March 2012 06:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Is this XML well formed and conforming to the schemas? Given you have
ns1:XDOMEA_Date as well, I get the sense that this element too should be
qualified with ns1.

On 21/03/2012 3:24 PM, Sascha Petersen wrote:
> <XDOMEA XDOMEA_Version="1.0">


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[ATL] Is it possible to two classes (input) into one class (output) in a rule
Next Topic:[QVT] IN Model URI does not accept non XMI input
Goto Forum:
  


Current Time: Sat Dec 14 05:19:33 GMT 2024

Powered by FUDForum. Page generated in 0.02870 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top