Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend/Xpand] Encoding problem
[Xtend/Xpand] Encoding problem [message #557327] Mon, 06 September 2010 18:25 Go to next message
Volker Wegert is currently offline Volker WegertFriend
Messages: 182
Registered: July 2009
Senior Member
Hello all,

I've got a problem with an Xtend/Xpand project that ocurred only after
migrating to Eclipse HELIOS and upgrading the M2T components accordingly. The
project in question consists of a standalone application that contains the
workflow and template files embedded in a plug-in. The workflow is called
programmatically from within the running application (that was itself launched
from Eclipse) and - since the migration - invariably aborts with the error "no
viable alternative at input 'Â' on line 1.". The workspace default encoding is
set to UTF-8, and I've checked that the file is set to respect the workspace
default encoding. I've double-checked with a hex editor that the file is
indeed UTF-8 encoded. From the error message I guess that some component reads
the UTF-8 file as ISO-8859-1(5). I've tried to set the file encoding in the
workflow file using <fileEncoding value="UTF-8"/>, but that didn't change
anything. What else could I try?

Thanks
Volker Wegert
Re: [Xtend/Xpand] Encoding problem [message #557331 is a reply to message #557327] Mon, 06 September 2010 19:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

how did you set the encoding? did you set it as the docs tell?

<component class="org.eclipse.xpand2.Generator">
 <metaModel idRef="mm_emf"/>
 <expand
  value="template::Template::main FOR model" />
 <outlet path="${src-gen}" >
  <postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
 </outlet>
 <resourceManager class ="org.eclipse.xtend.expression.ResourceManagerDefaultImpl">
  <fileEncoding value="UTF-8"/>
 </resourceManager>
</component>


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 06 September 2010 19:39]

Report message to a moderator

Re: [Xtend/Xpand] Encoding problem [message #557767 is a reply to message #557331] Wed, 08 September 2010 19:04 Go to previous messageGo to next message
Volker Wegert is currently offline Volker WegertFriend
Messages: 182
Registered: July 2009
Senior Member
Christian,

thanks for the info.

Christian Dietrich <christian.dietrich@itemis.de> writes:
> <component class="org.eclipse.xpand2.Generator">
> <metaModel idRef="mm_emf"/>
> <expand
> value="template::Template::main FOR model" />
> <outlet path="${src-gen}" >
> <postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
> </outlet>
> <resourceManager class ="org.eclipse.xtend.expression.ResourceManagerDefaultImpl">
> <fileEncoding value="ISO-8859-1"/>
> </resourceManager>
> </component>

No, I did it the way the example in the online help shows (Xpand --> Reference -->
XPand / ... Reference --> Xpand2 --> Generator Workflow Component) - that is,
placing the <fileEncoding directly beneath the <component. Your way of
specifying the encoding worked, so maybe the other documentation needs an
update?

And btw, I wonder whether there's something wrong with the chapter and tree
structure of the AOP section of the documentation - it looks rather weird...

Volker
Re: [Xtend/Xpand] Encoding problem [message #557769 is a reply to message #557767] Wed, 08 September 2010 19:31 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i actually took it from the docs. (head revision from cvs http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2t/org .eclipse.xpand/doc/org.eclipse.xpand.doc/help/xpand_referenc e_introduction.html?root=Modeling_Project&view=co)

the file encoding in the generator is for the ecoding of the output not the templates.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Acceleo 3] ownedElement + filter + reject : unexpected behavior
Next Topic:[Acceleo3] Generation for user defined metamodels
Goto Forum:
  


Current Time: Fri Apr 26 11:49:08 GMT 2024

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

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

Back to the top