Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Acceleo and Xtext metamodel(Getting errors when want to use metamodel created by Xtext)
Acceleo and Xtext metamodel [message #1611853] Wed, 11 February 2015 16:58 Go to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
Hi,

I have been trying to generate code for my own metamodel created in Xtext by Acceleo. However, I receive the following errors.

Quote:

Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseExceptionpublicId: file:/C:/workspaces/URN/org.xtext.tgrl.samples/pkg01/p001.xgrl; systemId: file:/C:/workspaces/URN/org.xtext.tgrl.samples/pkg01/p001.xgrl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:391)
at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:356)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:475)
at org.eclipse.acceleo.module.tgrl.main.Generate.<init>(Generate.java:90)
at org.eclipse.acceleo.module.tgrl.main.Generate.main(Generate.java:144)
Caused by: org.xml.sax.SAXParseExceptionpublicId: file:/C:/workspaces/URN/org.xtext.tgrl.samples/pkg01/p001.xgrl; systemId: file:/C:/workspaces/URN/org.xtext.tgrl.samples/pkg01/p001.xgrl; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 6 more



The steps I have followed:
- developed my xText language and installed it on my Eclipse. Now, I can work with my plugin. I can also see AST in the outline section.
- I created a small Acceleo project which creates a file without any consideration. When I run "generate.mtl" file inside of eclipse I receive the above error.
The Acceleo file is like this:

Quote:

[comment encoding = UTF-8 /]
[**
* The documentation of the module generate.
*/]
[module generate('http://www.xtext.org/grl/tgrl/TGRL')]


[**
* The documentation of the template generateElement.
* @param aModel
*/]
[template public generateElement(aModel : Model)]
[comment @main/]
[file ('a.txt', false, 'UTF-8')]
This is an example.
[/file]
[/template]



I am sure that the Acceleo works fine because I applied the same process on UML and it worked.
In a topic, it's said there might be no "bin" folder but I checked I have.

Any help will be appreciated.

Thanks.
Re: Acceleo and Xtext metamodel [message #1611910 is a reply to message #1611853] Wed, 11 February 2015 17:48 Go to previous messageGo to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
BTW, the model is not an XMI format. It's a text as we expect from xtext.
For example,Quote:

grl {
actor A{
}
actor B{
}
}
Re: Acceleo and Xtext metamodel [message #1612235 is a reply to message #1611910] Wed, 11 February 2015 22:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5967
Registered: July 2009
Senior Member
Hi

You probable need

XgrlStandaloneSetup.doSetup()

where Acceleo syas to regster your models.

Regards

Ed Willink

On 11/02/2015 17:48, duke vah wrote:
> BTW, the model is not an XMI format. It's a text as we expect from xtext.
> For example,Quote:
>> grl {
>> actor A{
>> }
>> actor B{
>> }
>> }
>
Re: Acceleo and Xtext metamodel [message #1612279 is a reply to message #1612235] Wed, 11 February 2015 23:28 Go to previous messageGo to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
Hi,

Could you be more specific.
Is it inside the generate.java?
Inside this file there are two registerPackages and registerResourceFactories files used for standalone use.
I'm running inside the eclipse and there is no another section that I can put doSetup().
I would be grateful if you could say exactly where I must put it.
Thanks.
Re: Acceleo and Xtext metamodel [message #1612323 is a reply to message #1612279] Thu, 12 February 2015 00:07 Go to previous messageGo to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
Hi,

I solved the issue. Thank you.
I write here the solution for the future reference.
What is needed is that just call doSetup() in two places
Quote:

public Generate(URI modelURI, File targetFolder,
List<? extends Object> arguments) throws IOException {
TGRLStandaloneSetup.doSetup();
initialize(modelURI, targetFolder, arguments);
}

Quote:

public Generate(EObject model, File targetFolder,
List<? extends Object> arguments) throws IOException {
TGRLStandaloneSetup.doSetup();
initialize(model, targetFolder, arguments);
}


Thanks.
Re: Acceleo and Xtext metamodel [message #1730705 is a reply to message #1612323] Wed, 27 April 2016 19:17 Go to previous messageGo to next message
nes ab is currently offline nes abFriend
Messages: 7
Registered: March 2016
Junior Member
Hi
please whate is the type of "TGRLStandaloneSetup"
thank you
Re: Acceleo and Xtext metamodel [message #1730706 is a reply to message #1730705] Wed, 27 April 2016 19:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12101
Registered: July 2009
Senior Member
TGRLStandaloneSetup is generated by xtext. its default name is MyDslStandaloneSetup.

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Acceleo and Xtext metamodel [message #1730708 is a reply to message #1730706] Wed, 27 April 2016 21:04 Go to previous messageGo to next message
nes ab is currently offline nes abFriend
Messages: 7
Registered: March 2016
Junior Member
Thank you so much your idea help me
Thanks
Re: Acceleo and Xtext metamodel [message #1781956 is a reply to message #1611853] Thu, 15 February 2018 08:04 Go to previous messageGo to next message
Souvik Das is currently offline Souvik DasFriend
Messages: 1
Registered: February 2018
Junior Member
Could you please tell me how to use xgrl as meta model to generate .mtl file.
@duke vah
Re: Acceleo and Xtext metamodel [message #1782046 is a reply to message #1612323] Fri, 16 February 2018 12:38 Go to previous messageGo to next message
Novarun Deb is currently offline Novarun DebFriend
Messages: 3
Registered: February 2018
Junior Member
Hi Duke,
I am encountering the exact same problem with a TGRL project.
I tried to follow your solution but I am getting an error at the doSetup() calls.

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
MyDslStandaloneSetup cannot be resolved
MyDslStandaloneSetup cannot be resolved

at org.eclipse.acceleo.module.GRL2Text.main.Generate.<init>(Generate.java:90)
at org.eclipse.acceleo.module.GRL2Text.main.Generate.main(Generate.java:146)

I have also tried to use the other object TGRLStandaloneSetup.doSetup(). But it is showing the same error.

Can you please tell me which object to use and where to find it in my system directory?

Thanks and Regards,
Novarun.
Re: Acceleo and Xtext metamodel [message #1782246 is a reply to message #1782046] Tue, 20 February 2018 20:12 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5967
Registered: July 2009
Senior Member
Hi

From the limited information you provide it looks like you have a classpath problem. Ensure that what you need is specified.

Regards

Ed Willink
Previous Topic:[Acceleo] How to access elements in for loop OR use a java service for that?
Next Topic:[Acceleo] Filename based on result of EOperation
Goto Forum:
  


Current Time: Sun Jul 15 20:52:31 GMT 2018

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

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

Back to the top