groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nelson, Erick" <Erick.Nel...@hdsupply.com>
Subject Re: Long String concatenation failed
Date Tue, 25 Sep 2018 12:57:07 GMT
Your example looked like you were building xml to me

Erick Nelson
Senior Developer – IT
HD Supply Facilities Maintenance
(858) 740-6523


From: Jmeter Tea <jmetertea@gmail.com>
Reply-To: "users@groovy.apache.org" <users@groovy.apache.org>
Date: Tuesday, September 25, 2018 at 5:55 AM
To: "users@groovy.apache.org" <users@groovy.apache.org>
Subject: Re: Long String concatenation failed

Thank for your answers, I still have some comments:
mg: I don't want to have a huge line with 20 parameters that can't be seen on screen so I
need new lines between parameters
Nelson, Erick: I don't need XML as the article suggest " builder classes to create XML "

On Tue, Sep 25, 2018 at 3:39 PM, Nelson, Erick <Erick.Nelson@hdsupply.com<mailto:Erick.Nelson@hdsupply.com>>
wrote:
No, I mean markup builder.
Mr Haki says it best….
http://mrhaki.blogspot.com/2009/10/groovy-goodness-creating-xml-with.html


Erick Nelson
Senior Developer – IT
HD Supply Facilities Maintenance
(858) 740-6523


From: mg <mgbiz@arscreat.com<mailto:mgbiz@arscreat.com>>
Reply-To: "users@groovy.apache.org<mailto:users@groovy.apache.org>" <users@groovy.apache.org<mailto:users@groovy.apache.org>>
Date: Tuesday, September 25, 2018 at 5:19 AM
To: "users@groovy.apache.org<mailto:users@groovy.apache.org>" <users@groovy.apache.org<mailto:users@groovy.apache.org>>
Subject: Re: Long String concatenation failed

If it is just the CTE that is the problem, you just have ro move the "<<" to the end
of the previous line...

-------- Ursprüngliche Nachricht --------
Von: Jmeter Tea <jmetertea@gmail.com<mailto:jmetertea@gmail.com>>
Datum: 25.09.18 09:56 (GMT+01:00)
An: users@groovy.apache.org<mailto:users@groovy.apache.org>
Betreff: Long String concatenation failed


Hello,

I have to  concatenate a lot of variables in a script and I want to make it readable, but
I failed to separate lines as in java, The following code doesn't compile due to:

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Script1.groovy: 2: unexpected token: << @ line 2, column 1.

   << vars["id2"] << "<id2>"



Code:

String text ="<id>" <<vars["id1"] << "<id><id2>"

<< vars["id2"] << "<id2>";

Is there a workaround or a better way concatenation a string in groovy?

Related question:
https://stackoverflow.com/questions/47786399/jmeter-groovy-script-concatenation-of-variables

Thank you

Mime
View raw message