Sumit
Sumit

Reputation: 1430

Using variable value inside xml tag in Scala

I'm trying to use a variable value inside an xml tag in Scala:

val currentEnv = "hadoop-uat-1"
val value = <property><name>fs.defaultFS</name><value>hdfs:// + currentEnv + :8020</value> <final>true</final></property>

But it doesn't work like this. Any idea on where I'm going wrong? Basically I don't want to hardcode the value because multiple env is present.

Upvotes: 0

Views: 88

Answers (1)

Tausif Sayyad
Tausif Sayyad

Reputation: 258

You can use a dynamic variable with XML tags using {variableName} syntax

val currentEnv = "hadoop-uat-1"
val value = <property><name>fs.defaultFS</name><value>hdfs://{currentEnv}:8020</value> <final>true</final></property>

Upvotes: 1

Related Questions