transforming an XML to text file [message #1066695] |
Wed, 03 July 2013 19:26 |
achraf lyazidi Messages: 12 Registered: May 2013 |
Junior Member |
|
|
Hi everyone,
im trying to transform and XML file to a textual one with ATL, but when i run my transformation, i got this error:
Quote:org.eclipse.m2m.atl.engine.emfvm.VMException: Operation toString2: wrong number of parameters
at toString2#86(XML2Text.atl[23:6-23:32])
local variables: self=IN!text, indent=' ', na=Sequence {IN!<unnamed>}, a=Sequence {}, acc='', e=IN!<unnamed>
at toString2#86(XML2Text.atl[23:6-23:32])
local variables: self=IN!name, indent=' ', na=Sequence {IN!text}, a=Sequence {}, acc='', e=IN!text
at toString2#86(XML2Text.atl[23:6-23:32])
local variables: self=IN!pnml, indent='', na=Sequence {IN!name, IN!net}, a=Sequence {IN!xmlns}, acc='', e=IN!name
at main#7(XML2Text.atl[1:18-3:25])
local variables: self=XML2Text : ASMModule
This is my ATL file :
query XML2Text = XML!Root.allInstances()
->asSequence()
->first().toString2('').writeTo('C:/Users/Desktop/Master/Semestre 4- PFE/workspacepfe/fam/Models/outProblemOrAndText.xml');
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;
Note that before i got this XML file, i did 2 transformation from BPMN to PetriNet, and from PetriNet to XML
|
|
|
|
Powered by
FUDForum. Page generated in 0.03898 seconds