|
Re: XML2SQLtext [message #1060555 is a reply to message #1060554] |
Sun, 26 May 2013 18:55 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
OCL 2.3 introduced the standard Java escape sequences (with the
exception of octal) so you could try \'.
However ATL uses a non-standard OCL vagely based on OCL 2.0, so it may
not support it; however most likely ATL like many other OCL
implementations anticipated the obvious specification evolution.
Regards
Ed Willink
On 26/05/2013 19:07, samar sousou wrote:
> 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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02845 seconds