Mule ESB: Getting rid of XML spaces in Groovy Output -


I am executing logs in Groovy in the script to populate in XML as part of this I In grabbing values ​​stored in variables & amp; Use them in Groovy to update them XML ahead. Although I think that when I put these values ​​in, I feel that the extra spaces are attached in production. This output is:

  & lt; Address 1 & gt; 4375 West 1980 South & lt; / Address1 & gt; & Lt; Address 2 & gt; & Lt; / Address 2 & gt; & Lt; Address 3 & gt; & Lt; / Address3 & gt; & Lt; CityName & gt; Soul Lake City & lt; / CityName & gt;  

I want to make it appear in the production without any spaces:

  & lt; Address 1 & gt; 4375 West 1980 South & lt; / Address1 & gt; & Lt; Address 2 & gt; & Lt; / Address 2 & gt; & Lt; Address 3 & gt; & Lt; / Address3 & gt; & Lt; CityName & gt; Soul Lake City & lt; / CityName & gt;  

My code is for your reference:

  & lt; Set-variable doc: name = "address1" value = "# [message.payload [0] .address1]" variableName = "address1" & gt; & Lt; / Set-variable> & Lt; Set-variable doc: name = "address2" value = "# [message.payload [0] .address 2]" variableName = "address2" & gt; & Lt; / Set-variable> & Lt; Set-variable doc: name = "address3" value = "# [message.payload [0]. Address 3]" variableName = "address3" & gt; & Lt; / Set-variable> & Lt; Set-variable doc: name = "city" value = "# [message.payload [0] .cti" variable "name =" city "> gt; & lt; / set-variable & gt; & lt; scripting: component Document: name = "Groovy" & gt; Screenplay: Script Engine = "Groove" & gt; & lt ;! [CDATA [// purse record = new XML slipper (false, false) .Perstate (payload) information = Records.Infos.Info.Fund {E-> E.InfoType.text (.) Equal ('Addr')} // Set the data data. Address 1. InstallationBody (Flyers ['Address1']) Info.Address2.replaceBody (flowVars ['address2']) info.Address3.replaceBody (FlowVars ['address3']) info.CityName.replaceBody (FlowVars ['city'])  

Really appreciate your input

-S

You are not sharing your payload, but I think that comes from the empty space, if you can not recover the payload, trim the variable: < / P>

  value = "# [payload [0] .address1.trim ()]  

or

  flowVars [ 'Address1']. Trim ()  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -