Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XML2SQLtext
XML2SQLtext [message #1060554] Sun, 26 May 2013 14:07 Go to previous message
samar sousou is currently offline samar sousou
Messages: 58
Registered: March 2013
Member
Hi,
I have a problem when i generate my ATL file is:

query XML2Text = XML!Root.allInstances()->asSequence().first().toString2('').writeTo('./projetSQL/example5.sql');

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
'insert into ' + self.name +' values('+
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()

)

else ''
endif;

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

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

and my result is like this:
insert into m values()
insert into composant values("F","01","6894f6ab",)
....

but I do not want it to take into consideration the root and leaves me something like this:

insert into composant values('F','01','6894f6ab')
....

I didn't found how to do the apostrophe.


thank you,

Samar

 
Read Message
Read Message
Previous Topic:Create List in template
Goto Forum:
  


Current Time: Tue May 28 15:07:34 EDT 2013

Powered by FUDForum. Page generated in 0.02137 seconds