Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Microsoft Office Excel Extractor Problem
Microsoft Office Excel Extractor Problem [message #1790932] Wed, 20 June 2018 10:30 Go to next message
ashrafur rahman is currently offline ashrafur rahmanFriend
Messages: 21
Registered: May 2018
Junior Member
I tried to run the following example:
https://www.eclipse.org/atl/atlTransformations/#MSOfficeExcelExtractor

But I am getting some error.

ATL file:

query XML2Text = XML!Root.allInstances()
		->asSequence()
		->first().ExcelFile().writeTo('exampleExcelJavaSource.xml');

helper context XML!Root def: ExcelFile() : String =
	'<?xml version="1.0"?>'+'\n'+'<?mso-application progid="Excel.Sheet"?>'+'\n'
	+ self.toString2('');
	

helper context XML!Element def: toString2(indent : String) : String =
	let na : Sequence(XML!Node) =
		self.children->select(e | not e.oclIsKindOf(XML!Attribute)) in
	let a : Sequence(XML!Node) =
		self.children->select(e | e.oclIsKindOf(XML!Attribute)) in
	indent + '<' + self.name + 
	a->iterate(e; acc : String = '' |
		acc + ' ' + e.toString2()
	) +
	if na->size() > 0 then
		'>'
		+ na->iterate(e; acc : String = '' |
			acc + 
			if e.oclIsKindOf(XML!Text) then
				''
			else
				'\r\n'
			endif
				+ e.toString2(indent + '  ')	
		) +
		if na->first().oclIsKindOf(XML!Text) then
			'</' + self.name + '>'
			else
				'\r\n' + indent + '</' + self.name + '>'
		endif
	else
		'/>'
	endif;

	
helper context XML!Attribute def: toString2() : String =
	self.name + '=\"' + self.value + '\"';


helper context XML!Text def: toString2() : String =
	self.value;




Error:

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation toString2: wrong number of parameters
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Data, indent='          ', na=Sequence {IN!<unnamed>}, a=Sequence {IN!ss:Type}, acc='', e=IN!<unnamed>
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Cell, indent='        ', na=Sequence {IN!Data}, a=Sequence {}, acc='', e=IN!Data
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Row, indent='      ', na=Sequence {IN!Cell, IN!Cell, IN!Cell, IN!Cell, IN!Cell}, a=Sequence {}, acc='', e=IN!Cell
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Table, indent='    ', na=Sequence {IN!Column, IN!Column, IN!Column, IN!Column, IN!Column, IN!Row, IN!Row, IN!Row, IN!Row, IN!Row}, a=Sequence {}, acc='
      <Column ss:Width="150.0"/>
      <Column ss:Width="150.0"/>
      <Column ss:Width="150.0"/>
      <Column ss:Width="150.0"/>
      <Column ss:Width="150.0"/>', e=IN!Row
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Worksheet, indent='  ', na=Sequence {IN!Table}, a=Sequence {IN!ss:Name}, acc='', e=IN!Table
	at toString2#86(XML2Text.atl[28:7-28:33])
		local variables: self=IN!Workbook, indent='', na=Sequence {IN!Worksheet}, a=Sequence {IN!xmlns, IN!xmlns:ss}, acc='', e=IN!Worksheet
	at ExcelFile#9(XML2Text.atl[7:4-7:22])
		local variables: self=IN!Workbook
	at main#6(XML2Text.atl[1:18-3:24])
		local variables: self=XML2Text : ASMModule


Here, the error shows, "Operation toString2: wrong number of parameters"
But I think code is okay, can you please help me?
Re: Microsoft Office Excel Extractor Problem [message #1791089 is a reply to message #1790932] Fri, 22 June 2018 17:08 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 379
Registered: September 2012
Location: Belgium
Senior Member

Regular ATL does not support operation overloading (same name and context, different parameters). Either choose another operation name for the different toString2() variants, or use the EMFTVM runtime.

Cheers,
Dennis
Re: Microsoft Office Excel Extractor Problem [message #1791107 is a reply to message #1791089] Sat, 23 June 2018 08:55 Go to previous message
ashrafur rahman is currently offline ashrafur rahmanFriend
Messages: 21
Registered: May 2018
Junior Member
Thanks a lot. I will try to do this with a different name. But I was wondering, it is available in the official transformation list, so they must be tested it successfully before posting it. How did it work in that case?
Previous Topic:Output model creation and extraction problem
Next Topic:UML profile to Ecore transformation
Goto Forum:
  


Current Time: Wed Nov 14 09:15:18 GMT 2018

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

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

Back to the top