Home » Modeling » ATL » Microsoft Office Excel Extractor Problem
Microsoft Office Excel Extractor Problem [message #1790932] |
Wed, 20 June 2018 10:30 |
ashrafur rahman 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?
|
|
| | |
Goto Forum:
Current Time: Sat Nov 11 08:21:00 GMT 2023
Powered by FUDForum. Page generated in 0.02008 seconds
|