Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] No type named 'Root' in metamodel
[ATL] No type named 'Root' in metamodel [message #869372] Thu, 03 May 2012 09:57
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Hi,

I am trying to perform an ATL transformation directly within a java application. The strange thing is, when I use XMLInjector zu load the input XML file, I get this error:

No type named 'Root' in metamodel 'MY'
java.lang.NullPointerException
	at org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.newModelElement(ASMEMFModel.java:281)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMModel.java:81)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMModel.java:68)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.startElement(XMLInjector.java:170)
	at org.eclipse.m2m.atl.engine.injectors.xml.ProtectedHandler.startElement(ProtectedHandler.java:49)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.performImportation(XMLInjector.java:106)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.inject(XMLInjector.java:89)
	at Transformation.main(Transformation.java:139)
No type named 'Text' in metamodel 'MY'
java.lang.NullPointerException
	at org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.newModelElement(ASMEMFModel.java:281)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMModel.java:81)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMModel.java:68)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.characters(XMLInjector.java:132)
	at org.eclipse.m2m.atl.engine.injectors.xml.ProtectedHandler.characters(ProtectedHandler.java:40)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.characters(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.performImportation(XMLInjector.java:106)
	at org.eclipse.m2m.atl.engine.injectors.xml.XMLInjector.inject(XMLInjector.java:89)
	at Transformation.main(Transformation.java:139)
No type named 'Text' in metamodel 'MY'
java.lang.NullPointerException


"MY" is my own Metamodel for the XML file. The funny thing is: In the model there is neither a element called "Root" or an element called "Text". These types are not part of the metamodel because they are not meant to be there. And in the model they are neither. So, why does ATL talk about Text and Root elements? Smile Any ideas?

Regards,

Tex

Edit:



                XMLInjector xmli = new XMLInjector();
		try {

                        inputModel = mh.createModelLoader().newModel("IN", inputModelUrl.getFile(), myMetaModel);
			in = new FileInputStream(inputModelUrl.getFile());

			/*int c;
			while((c = in.read()) > 0) {
				System.out.print((char)c);
			}*/
			xmli.inject(inputModel, in, parameters); // Do injection !

		} catch(Exception e) {
			System.out.println(e);
		} 
		


This is, where the error occurs. The line: xmli.inject.

I used the commented section to check, whether the read file is correct and no, there is no Text or Root element Smile

[Updated on: Thu, 03 May 2012 10:05]

Report message to a moderator

Previous Topic:[ATL] How to find the package owning a class ?
Next Topic:ATL - Creating a PackagedElement within my XMI file
Goto Forum:
  


Current Time: Tue Sep 16 09:41:18 GMT 2014

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

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